mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
tcp: fix recv with flags MSG_WAITALL | MSG_PEEK
Currently, tcp_recvmsg enters a busy loop in sk_wait_data if called with flags = MSG_WAITALL | MSG_PEEK. sk_wait_data waits for sk_receive_queue not empty, but in this case, the receive queue is not empty, but does not contain any skb that we can use. Add a "last skb seen on receive queue" argument to sk_wait_data, so that it sleeps until the receive queue has new skbs. Link: https://bugzilla.kernel.org/show_bug.cgi?id=99461 Link: https://sourceware.org/bugzilla/show_bug.cgi?id=18493 Link: https://bugzilla.redhat.com/show_bug.cgi?id=1205258 Reported-by: Enrico Scholz <[email protected]> Reported-by: Dan Searle <[email protected]> Signed-off-by: Sabrina Dubroca <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
3d3af88592
commit
dfbafc9953
5 changed files with 14 additions and 10 deletions
|
|
@ -613,7 +613,7 @@ static int llc_wait_data(struct sock *sk, long timeo)
|
|||
if (signal_pending(current))
|
||||
break;
|
||||
rc = 0;
|
||||
if (sk_wait_data(sk, &timeo))
|
||||
if (sk_wait_data(sk, &timeo, NULL))
|
||||
break;
|
||||
}
|
||||
return rc;
|
||||
|
|
@ -802,7 +802,7 @@ static int llc_ui_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
|
|||
release_sock(sk);
|
||||
lock_sock(sk);
|
||||
} else
|
||||
sk_wait_data(sk, &timeo);
|
||||
sk_wait_data(sk, &timeo, NULL);
|
||||
|
||||
if ((flags & MSG_PEEK) && peek_seq != llc->copied_seq) {
|
||||
net_dbg_ratelimited("LLC(%s:%d): Application bug, race in MSG_PEEK\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue