]> git.neil.brown.name Git - history.git/commitdiff
tcp_recvmsg: Fix application bug induced races with MSG_PEEK and copied_seq.
authorAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Tue, 21 May 2002 08:41:40 +0000 (01:41 -0700)
committerDavid S. Miller <davem@nuts.ninka.net>
Tue, 21 May 2002 08:41:40 +0000 (01:41 -0700)
net/ipv4/tcp.c

index 8d34e1b85241f5d9948a45323524c1509d423bde..101902210bce21a40d49df74a830f33050051d0b 100644 (file)
@@ -1674,6 +1674,12 @@ do_prequeue:
                                }
                        }
                }
+               if ((flags & MSG_PEEK) && peek_seq != tp->copied_seq) {
+                       if (net_ratelimit())
+                               printk(KERN_DEBUG "TCP(%s:%d): Application bug, race in MSG_PEEK.\n",
+                                      current->comm, current->pid);
+                       peek_seq = tp->copied_seq;
+               }
                continue;
 
        found_ok_skb: