Commit 589a54dc authored by Alexey Kuznetsov's avatar Alexey Kuznetsov Committed by David S. Miller

tcp_recvmsg: Fix application bug induced races with MSG_PEEK and copied_seq.

parent d283ad89
...@@ -1674,6 +1674,12 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg, ...@@ -1674,6 +1674,12 @@ int tcp_recvmsg(struct sock *sk, struct msghdr *msg,
} }
} }
} }
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; continue;
found_ok_skb: found_ok_skb:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment