diff options
author | Simon Horman <horms@verge.net.au> | 2008-10-06 17:40:11 -0400 |
---|---|---|
committer | Simon Horman <horms@verge.net.au> | 2008-10-06 17:40:11 -0400 |
commit | a5e8546a8bff5d2047adc279df5753c44ba7b1a1 (patch) | |
tree | d9ca91f74d8279adbb1d3e942cc7ab145780ee29 /net/ipv4/tcp.c | |
parent | cb7f6a7b716e801097b564dec3ccb58d330aef56 (diff) | |
parent | c7004482e8dcb7c3c72666395cfa98a216a4fb70 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 into lvs-next-2.6
Diffstat (limited to 'net/ipv4/tcp.c')
-rw-r--r-- | net/ipv4/tcp.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 1ab341e5d3e0..7d81a1ee5507 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -384,13 +384,17 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
384 | 384 | ||
385 | /* Connected? */ | 385 | /* Connected? */ |
386 | if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) { | 386 | if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) { |
387 | int target = sock_rcvlowat(sk, 0, INT_MAX); | ||
388 | |||
389 | if (tp->urg_seq == tp->copied_seq && | ||
390 | !sock_flag(sk, SOCK_URGINLINE) && | ||
391 | tp->urg_data) | ||
392 | target--; | ||
393 | |||
387 | /* Potential race condition. If read of tp below will | 394 | /* Potential race condition. If read of tp below will |
388 | * escape above sk->sk_state, we can be illegally awaken | 395 | * escape above sk->sk_state, we can be illegally awaken |
389 | * in SYN_* states. */ | 396 | * in SYN_* states. */ |
390 | if ((tp->rcv_nxt != tp->copied_seq) && | 397 | if (tp->rcv_nxt - tp->copied_seq >= target) |
391 | (tp->urg_seq != tp->copied_seq || | ||
392 | tp->rcv_nxt != tp->copied_seq + 1 || | ||
393 | sock_flag(sk, SOCK_URGINLINE) || !tp->urg_data)) | ||
394 | mask |= POLLIN | POLLRDNORM; | 398 | mask |= POLLIN | POLLRDNORM; |
395 | 399 | ||
396 | if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { | 400 | if (!(sk->sk_shutdown & SEND_SHUTDOWN)) { |