aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-02-22 15:18:07 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-02-22 15:18:07 -0500
commitdea08e604408d0303e2332896c5fdd8c1f7d79a2 (patch)
treedbe8aa3fbfba7dc0e9878de152e8efe537b2b4b5 /net/unix/af_unix.c
parent5c102d0eca3c41b10ccc1525cbb1eba7fd6efd7c (diff)
parentd856626d3b051a3ad7139ba59463b692c131f844 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: "Looks like a lot, but mostly driver fixes scattered all over as usual. Of note: 1) Add conditional sched in nf conntrack in cleanup to avoid NMI watchdogs. From Florian Westphal. 2) Fix deadlock in nfnetlink cttimeout, also from Floarian. 3) Fix handling of slaves in bonding ARP monitor validation, from Jay Vosburgh. 4) Callers of ip_cmsg_send() are responsible for freeing IP options, some were not doing so. Fix from Eric Dumazet. 5) Fix per-cpu bugs in mvneta driver, from Gregory CLEMENT. 6) Fix vlan handling in mv88e6xxx DSA driver, from Vivien Didelot. 7) bcm7xxx PHY driver bug fixes from Florian Fainelli. 8) Avoid unaligned accesses to protocol headers wrt. GRE, from Alexander Duyck. 9) SKB leaks and other problems in arc_emac driver, from Alexander Kochetkov. 10) tcp_v4_inbound_md5_hash() releases listener socket instead of request socket on error path, oops. Fix from Eric Dumazet. 11) Missing socket release in pppoe_rcv_core() that seems to have existed basically forever. From Guillaume Nault. 12) Missing slave_dev unregister in dsa_slave_create() error path, from Florian Fainelli. 13) crypto_alloc_hash() never returns NULL, fix return value check in __tcp_alloc_md5sig_pool. From Insu Yun. 14) Properly expire exception route entries in ipv4, from Xin Long. 15) Fix races in tcp/dccp listener socket dismantle, from Eric Dumazet. 16) Don't set IFF_TX_SKB_SHARING in vxlan, geneve, or GRE, it's not legal. These drivers modify the SKB on transmit. From Jiri Benc. 17) Fix regression in the initialziation of netdev->tx_queue_len. From Phil Sutter. 18) Missing unlock in tipc_nl_add_bc_link() error path, from Insu Yun. 19) SCTP port hash sizing does not properly ensure that table is a power of two in size. From Neil Horman. 20) Fix initializing of software copy of MAC address in fmvj18x_cs driver, from Ken Kawasaki" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (129 commits) bnx2x: Fix 84833 phy command handler bnx2x: Fix led setting for 84858 phy. bnx2x: Correct 84858 PHY fw version bnx2x: Fix 84833 RX CRC bnx2x: Fix link-forcing for KR2 net: ethernet: davicom: fix devicetree irq resource fmvj18x_cs: fix incorrect indexing of dev->dev_addr[] when copying the MAC address Driver: Vmxnet3: Update Rx ring 2 max size net: netcp: rework the code for get/set sw_data in dma desc soc: ti: knav_dma: rename pad in struct knav_dma_desc to sw_data net: ti: netcp: restore get/set_pad_info() functionality MAINTAINERS: Drop myself as xen netback maintainer sctp: Fix port hash table size computation can: ems_usb: Fix possible tx overflow Bluetooth: hci_core: Avoid mixing up req_complete and req_complete_skb net: bcmgenet: Fix internal PHY link state af_unix: Don't use continue to re-execute unix_stream_read_generic loop unix_diag: fix incorrect sign extension in unix_lookup_by_ino bnxt_en: Failure to update PHY is not fatal condition. bnxt_en: Remove unnecessary call to update PHY settings. ...
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 29be035f9c65..f75f847e688d 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1781,7 +1781,12 @@ restart_locked:
1781 goto out_unlock; 1781 goto out_unlock;
1782 } 1782 }
1783 1783
1784 if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) { 1784 /* other == sk && unix_peer(other) != sk if
1785 * - unix_peer(sk) == NULL, destination address bound to sk
1786 * - unix_peer(sk) == sk by time of get but disconnected before lock
1787 */
1788 if (other != sk &&
1789 unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
1785 if (timeo) { 1790 if (timeo) {
1786 timeo = unix_wait_for_peer(other, timeo); 1791 timeo = unix_wait_for_peer(other, timeo);
1787 1792
@@ -2277,13 +2282,15 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
2277 size_t size = state->size; 2282 size_t size = state->size;
2278 unsigned int last_len; 2283 unsigned int last_len;
2279 2284
2280 err = -EINVAL; 2285 if (unlikely(sk->sk_state != TCP_ESTABLISHED)) {
2281 if (sk->sk_state != TCP_ESTABLISHED) 2286 err = -EINVAL;
2282 goto out; 2287 goto out;
2288 }
2283 2289
2284 err = -EOPNOTSUPP; 2290 if (unlikely(flags & MSG_OOB)) {
2285 if (flags & MSG_OOB) 2291 err = -EOPNOTSUPP;
2286 goto out; 2292 goto out;
2293 }
2287 2294
2288 target = sock_rcvlowat(sk, flags & MSG_WAITALL, size); 2295 target = sock_rcvlowat(sk, flags & MSG_WAITALL, size);
2289 timeo = sock_rcvtimeo(sk, noblock); 2296 timeo = sock_rcvtimeo(sk, noblock);
@@ -2305,6 +2312,7 @@ static int unix_stream_read_generic(struct unix_stream_read_state *state)
2305 bool drop_skb; 2312 bool drop_skb;
2306 struct sk_buff *skb, *last; 2313 struct sk_buff *skb, *last;
2307 2314
2315redo:
2308 unix_state_lock(sk); 2316 unix_state_lock(sk);
2309 if (sock_flag(sk, SOCK_DEAD)) { 2317 if (sock_flag(sk, SOCK_DEAD)) {
2310 err = -ECONNRESET; 2318 err = -ECONNRESET;
@@ -2329,9 +2337,11 @@ again:
2329 goto unlock; 2337 goto unlock;
2330 2338
2331 unix_state_unlock(sk); 2339 unix_state_unlock(sk);
2332 err = -EAGAIN; 2340 if (!timeo) {
2333 if (!timeo) 2341 err = -EAGAIN;
2334 break; 2342 break;
2343 }
2344
2335 mutex_unlock(&u->readlock); 2345 mutex_unlock(&u->readlock);
2336 2346
2337 timeo = unix_stream_data_wait(sk, timeo, last, 2347 timeo = unix_stream_data_wait(sk, timeo, last,
@@ -2344,7 +2354,7 @@ again:
2344 } 2354 }
2345 2355
2346 mutex_lock(&u->readlock); 2356 mutex_lock(&u->readlock);
2347 continue; 2357 goto redo;
2348unlock: 2358unlock:
2349 unix_state_unlock(sk); 2359 unix_state_unlock(sk);
2350 break; 2360 break;