diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 15:30:19 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-06 15:30:19 -0500 |
commit | abb359450f20c32ae03039d8736f12b1d561caf5 (patch) | |
tree | 6e8723885feb66a138f19f0ff31615dc13a8d859 /net/unix/af_unix.c | |
parent | cb600d2f83c854ec3d6660063e4466431999489b (diff) | |
parent | 4e3dbdb1392a83bd21a6ff8f6bc785495058d37c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1436 commits)
cassini: Use local-mac-address prom property for Cassini MAC address
net: remove the duplicate #ifdef __KERNEL__
net: bridge: check the length of skb after nf_bridge_maybe_copy_header()
netconsole: clarify stopping message
netconsole: don't announce stopping if nothing happened
cnic: Fix the type field in SPQ messages
netfilter: fix export secctx error handling
netfilter: fix the race when initializing nf_ct_expect_hash_rnd
ipv4: IP defragmentation must be ECN aware
net: r6040: Return proper error for r6040_init_one
dcb: use after free in dcb_flushapp()
dcb: unlock on error in dcbnl_ieee_get()
net: ixp4xx_eth: Return proper error for eth_init_one
include/linux/if_ether.h: Add #define ETH_P_LINK_CTL for HPNA and wlan local tunnel
net: add POLLPRI to sock_def_readable()
af_unix: Avoid socket->sk NULL OOPS in stream connect security hooks.
net_sched: pfifo_head_drop problem
mac80211: remove stray extern
mac80211: implement off-channel TX using hw r-o-c offload
mac80211: implement hardware offload for remain-on-channel
...
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2268e6798124..dd419d286204 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -316,7 +316,8 @@ static void unix_write_space(struct sock *sk) | |||
316 | if (unix_writable(sk)) { | 316 | if (unix_writable(sk)) { |
317 | wq = rcu_dereference(sk->sk_wq); | 317 | wq = rcu_dereference(sk->sk_wq); |
318 | if (wq_has_sleeper(wq)) | 318 | if (wq_has_sleeper(wq)) |
319 | wake_up_interruptible_sync(&wq->wait); | 319 | wake_up_interruptible_sync_poll(&wq->wait, |
320 | POLLOUT | POLLWRNORM | POLLWRBAND); | ||
320 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 321 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
321 | } | 322 | } |
322 | rcu_read_unlock(); | 323 | rcu_read_unlock(); |
@@ -1156,7 +1157,7 @@ restart: | |||
1156 | goto restart; | 1157 | goto restart; |
1157 | } | 1158 | } |
1158 | 1159 | ||
1159 | err = security_unix_stream_connect(sock, other->sk_socket, newsk); | 1160 | err = security_unix_stream_connect(sk, other, newsk); |
1160 | if (err) { | 1161 | if (err) { |
1161 | unix_state_unlock(sk); | 1162 | unix_state_unlock(sk); |
1162 | goto out_unlock; | 1163 | goto out_unlock; |
@@ -1736,7 +1737,8 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1736 | goto out_unlock; | 1737 | goto out_unlock; |
1737 | } | 1738 | } |
1738 | 1739 | ||
1739 | wake_up_interruptible_sync(&u->peer_wait); | 1740 | wake_up_interruptible_sync_poll(&u->peer_wait, |
1741 | POLLOUT | POLLWRNORM | POLLWRBAND); | ||
1740 | 1742 | ||
1741 | if (msg->msg_name) | 1743 | if (msg->msg_name) |
1742 | unix_copy_addr(msg, skb->sk); | 1744 | unix_copy_addr(msg, skb->sk); |
@@ -2099,13 +2101,12 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2099 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 2101 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
2100 | mask |= POLLERR; | 2102 | mask |= POLLERR; |
2101 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 2103 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
2102 | mask |= POLLRDHUP; | 2104 | mask |= POLLRDHUP | POLLIN | POLLRDNORM; |
2103 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 2105 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
2104 | mask |= POLLHUP; | 2106 | mask |= POLLHUP; |
2105 | 2107 | ||
2106 | /* readable? */ | 2108 | /* readable? */ |
2107 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 2109 | if (!skb_queue_empty(&sk->sk_receive_queue)) |
2108 | (sk->sk_shutdown & RCV_SHUTDOWN)) | ||
2109 | mask |= POLLIN | POLLRDNORM; | 2110 | mask |= POLLIN | POLLRDNORM; |
2110 | 2111 | ||
2111 | /* Connection-based need to check for termination and startup */ | 2112 | /* Connection-based need to check for termination and startup */ |
@@ -2117,20 +2118,19 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2117 | return mask; | 2118 | return mask; |
2118 | } | 2119 | } |
2119 | 2120 | ||
2120 | /* writable? */ | 2121 | /* No write status requested, avoid expensive OUT tests. */ |
2121 | writable = unix_writable(sk); | 2122 | if (wait && !(wait->key & (POLLWRBAND | POLLWRNORM | POLLOUT))) |
2122 | if (writable) { | 2123 | return mask; |
2123 | other = unix_peer_get(sk); | ||
2124 | if (other) { | ||
2125 | if (unix_peer(other) != sk) { | ||
2126 | sock_poll_wait(file, &unix_sk(other)->peer_wait, | ||
2127 | wait); | ||
2128 | if (unix_recvq_full(other)) | ||
2129 | writable = 0; | ||
2130 | } | ||
2131 | 2124 | ||
2132 | sock_put(other); | 2125 | writable = unix_writable(sk); |
2126 | other = unix_peer_get(sk); | ||
2127 | if (other) { | ||
2128 | if (unix_peer(other) != sk) { | ||
2129 | sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); | ||
2130 | if (unix_recvq_full(other)) | ||
2131 | writable = 0; | ||
2133 | } | 2132 | } |
2133 | sock_put(other); | ||
2134 | } | 2134 | } |
2135 | 2135 | ||
2136 | if (writable) | 2136 | if (writable) |