tcp: Try to catch MSG_PEEK bug
authorHerbert Xu <herbert@gondor.apana.org.au>
Mon, 19 Oct 2009 19:41:06 +0000 (19:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Oct 2009 07:51:57 +0000 (00:51 -0700)
This patch tries to print out more information when we hit the
MSG_PEEK bug in tcp_recvmsg.  It's been around since at least
2005 and it's about time that we finally fix it.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp.c

index 9b2756f..90b2e06 100644 (file)
@@ -1442,7 +1442,9 @@ int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                                goto found_ok_skb;
                        if (tcp_hdr(skb)->fin)
                                goto found_fin_ok;
-                       WARN_ON(!(flags & MSG_PEEK));
+                       if (WARN_ON(!(flags & MSG_PEEK)))
+                               printk(KERN_INFO "recvmsg bug 2: copied %X "
+                                      "seq %X\n", *seq, TCP_SKB_CB(skb)->seq);
                }
 
                /* Well, if we have backlog, try to process it now yet. */