aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2016-02-23 00:09:14 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-23 00:09:14 -0500
commitb633353115e352d3c31c12d4c61978c810f05ea1 (patch)
tree055174a1b31a3e10fd2c505788fe6487b0028d00 /net/unix/af_unix.c
parentb1d95ae5c5bd3deba84d00c4f83d7d0836b5936f (diff)
parentdea08e604408d0303e2332896c5fdd8c1f7d79a2 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Conflicts: drivers/net/phy/bcm7xxx.c drivers/net/phy/marvell.c drivers/net/vxlan.c All three conflicts were cases of simple overlapping changes. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index b3745557fc89..8269da73e9e5 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1496,7 +1496,7 @@ static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1496 UNIXCB(skb).fp = NULL; 1496 UNIXCB(skb).fp = NULL;
1497 1497
1498 for (i = scm->fp->count-1; i >= 0; i--) 1498 for (i = scm->fp->count-1; i >= 0; i--)
1499 unix_notinflight(scm->fp->fp[i]); 1499 unix_notinflight(scm->fp->user, scm->fp->fp[i]);
1500} 1500}
1501 1501
1502static void unix_destruct_scm(struct sk_buff *skb) 1502static void unix_destruct_scm(struct sk_buff *skb)
@@ -1558,7 +1558,7 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1558 return -ENOMEM; 1558 return -ENOMEM;
1559 1559
1560 for (i = scm->fp->count - 1; i >= 0; i--) 1560 for (i = scm->fp->count - 1; i >= 0; i--)
1561 unix_inflight(scm->fp->fp[i]); 1561 unix_inflight(scm->fp->user, scm->fp->fp[i]);
1562 return max_level; 1562 return max_level;
1563} 1563}
1564 1564
@@ -1778,7 +1778,12 @@ restart_locked:
1778 goto out_unlock; 1778 goto out_unlock;
1779 } 1779 }
1780 1780
1781 if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) { 1781 /* other == sk && unix_peer(other) != sk if
1782 * - unix_peer(sk) == NULL, destination address bound to sk
1783 * - unix_peer(sk) == sk by time of get but disconnected before lock
1784 */
1785 if (other != sk &&
1786 unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
1782 if (timeo) { 1787 if (timeo) {
1783 timeo = unix_wait_for_peer(other, timeo); 1788 timeo = unix_wait_for_peer(other, timeo);
1784 1789
@@ -2274,13 +2279,15 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
2274 size_t size = state->size; 2279 size_t size = state->size;
2275 unsigned int last_len; 2280 unsigned int last_len;
2276 2281
2277 err = -EINVAL; 2282 if (unlikely(sk->sk_state != TCP_ESTABLISHED)) {
2278 if (sk->sk_state != TCP_ESTABLISHED) 2283 err = -EINVAL;
2279 goto out; 2284 goto out;
2285 }
2280 2286
2281 err = -EOPNOTSUPP; 2287 if (unlikely(flags & MSG_OOB)) {
2282 if (flags & MSG_OOB) 2288 err = -EOPNOTSUPP;
2283 goto out; 2289 goto out;
2290 }
2284 2291
2285 target = sock_rcvlowat(sk, flags & MSG_WAITALL, size); 2292 target = sock_rcvlowat(sk, flags & MSG_WAITALL, size);
2286 timeo = sock_rcvtimeo(sk, noblock); 2293 timeo = sock_rcvtimeo(sk, noblock);
@@ -2302,6 +2309,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
2302 bool drop_skb; 2309 bool drop_skb;
2303 struct sk_buff *skb, *last; 2310 struct sk_buff *skb, *last;
2304 2311
2312redo:
2305 unix_state_lock(sk); 2313 unix_state_lock(sk);
2306 if (sock_flag(sk, SOCK_DEAD)) { 2314 if (sock_flag(sk, SOCK_DEAD)) {
2307 err = -ECONNRESET; 2315 err = -ECONNRESET;
@@ -2326,9 +2334,11 @@ again:
2326 goto unlock; 2334 goto unlock;
2327 2335
2328 unix_state_unlock(sk); 2336 unix_state_unlock(sk);
2329 err = -EAGAIN; 2337 if (!timeo) {
2330 if (!timeo) 2338 err = -EAGAIN;
2331 break; 2339 break;
2340 }
2341
2332 mutex_unlock(&u->readlock); 2342 mutex_unlock(&u->readlock);
2333 2343
2334 timeo = unix_stream_data_wait(sk, timeo, last, 2344 timeo = unix_stream_data_wait(sk, timeo, last,
@@ -2341,7 +2351,7 @@ again:
2341 } 2351 }
2342 2352
2343 mutex_lock(&u->readlock); 2353 mutex_lock(&u->readlock);
2344 continue; 2354 goto redo;
2345unlock: 2355unlock:
2346 unix_state_unlock(sk); 2356 unix_state_unlock(sk);
2347 break; 2357 break;