mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
net: qrtr: Check for exisiting waiters
Some non-blocking clients may not wait for the OUT event from select or poll before resending to a flow controlled port. Check for exisiting waiters before allocating a new one so these clients do not exhaust the memory pool. Change-Id: I5fc40d5b1d1819ea5bf94438c04ee42b42639ebc Signed-off-by: Chris Lew <clew@codeaurora.org>
This commit is contained in:
parent
885277a753
commit
cdb150a515
1 changed files with 8 additions and 0 deletions
|
|
@ -500,6 +500,12 @@ static int qrtr_tx_wait(struct qrtr_node *node, struct sockaddr_qrtr *to,
|
|||
break;
|
||||
}
|
||||
if (!ret) {
|
||||
list_for_each_entry(waiter, &flow->waiters, node) {
|
||||
if (waiter->sk == sk) {
|
||||
mutex_unlock(&node->qrtr_tx_lock);
|
||||
return -EAGAIN;
|
||||
}
|
||||
}
|
||||
waiter = kzalloc(sizeof(*waiter), GFP_KERNEL);
|
||||
if (!waiter) {
|
||||
mutex_unlock(&node->qrtr_tx_lock);
|
||||
|
|
@ -508,6 +514,8 @@ static int qrtr_tx_wait(struct qrtr_node *node, struct sockaddr_qrtr *to,
|
|||
waiter->sk = sk;
|
||||
sock_hold(sk);
|
||||
list_add_tail(&waiter->node, &flow->waiters);
|
||||
QRTR_INFO(node->ilc, "new waiter for [0x%x:0x%x]\n",
|
||||
to->sq_node, to->sq_port);
|
||||
mutex_unlock(&node->qrtr_tx_lock);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue