tcp: fix recv with flags MSG_WAITALL | MSG_PEEK
authorSabrina Dubroca <sd@queasysnail.net>
Fri, 24 Jul 2015 16:19:25 +0000 (18:19 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jul 2015 08:06:53 +0000 (01:06 -0700)
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 <rh-bugzilla@ensc.de>
Reported-by: Dan Searle <dan@censornet.com>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/sock.h
net/core/sock.c
net/dccp/proto.c
net/ipv4/tcp.c
net/llc/af_llc.c

Simple merge
diff --cc net/core/sock.c
Simple merge
Simple merge
diff --cc net/ipv4/tcp.c
Simple merge
Simple merge