]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: fix FIONREAD/SIOCINQ
authorEric Dumazet <edumazet@google.com>
Thu, 18 Oct 2012 09:14:12 +0000 (09:14 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Oct 2012 19:34:31 +0000 (15:34 -0400)
commit6d9ae718993d4c5284f1ed46adc97bec22618afc
tree8a9232aed518f5ce9acb862fc125aacc5cd7cebd
parent6ecf0919092c871c032e63a1165daabc17186859
tcp: fix FIONREAD/SIOCINQ

tcp_ioctl() tries to take into account if tcp socket received a FIN
to report correct number bytes in receive queue.

But its flaky because if the application ate the last skb,
we return 1 instead of 0.

Correct way to detect that FIN was received is to test SOCK_DONE.

Reported-by: Elliot Hughes <enh@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c