diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-04-14 11:00:36 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-04-14 11:00:36 -0400 |
commit | 277a163c83d7ba93fba1e8980d29a9f8bfcfba6c (patch) | |
tree | ccfd357d152292958957b6b8a993892e7a8cc95f /net/unix/af_unix.c | |
parent | a83b93a7480441a47856dc9104bea970e84cda87 (diff) | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
Merge tag 'v3.15-rc1' into patchwork
Linux 3.15-rc1
* tag 'v3.15-rc1': (12180 commits)
Linux 3.15-rc1
mm: Initialize error in shmem_file_aio_read()
cifs: Use min_t() when comparing "size_t" and "unsigned long"
sym53c8xx_2: Set DID_REQUEUE return code when aborting squeue
powerpc: Don't try to set LPCR unless we're in hypervisor mode
futex: update documentation for ordering guarantees
ceph: fix pr_fmt() redefinition
vti: don't allow to add the same tunnel twice
gre: don't allow to add the same tunnel twice
drivers: net: xen-netfront: fix array initialization bug
missing bits of "splice: fix racy pipe->buffers uses"
cifs: fix the race in cifs_writev()
ceph_sync_{,direct_}write: fix an oops on ceph_osdc_new_request() failure
pktgen: be friendly to LLTX devices
r8152: check RTL8152_UNPLUG
net: sun4i-emac: add promiscuous support
net/apne: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO
blackfin: cleanup board files
bf609: clock: drop unused clock bit set/clear functions
Blackfin: bf537: rename "CONFIG_ADT75"
...
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 29fc8bee9702..bb7e8ba821f4 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -163,9 +163,8 @@ static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb) | |||
163 | 163 | ||
164 | static inline unsigned int unix_hash_fold(__wsum n) | 164 | static inline unsigned int unix_hash_fold(__wsum n) |
165 | { | 165 | { |
166 | unsigned int hash = (__force unsigned int)n; | 166 | unsigned int hash = (__force unsigned int)csum_fold(n); |
167 | 167 | ||
168 | hash ^= hash>>16; | ||
169 | hash ^= hash>>8; | 168 | hash ^= hash>>8; |
170 | return hash&(UNIX_HASH_SIZE-1); | 169 | return hash&(UNIX_HASH_SIZE-1); |
171 | } | 170 | } |
@@ -1218,7 +1217,7 @@ restart: | |||
1218 | __skb_queue_tail(&other->sk_receive_queue, skb); | 1217 | __skb_queue_tail(&other->sk_receive_queue, skb); |
1219 | spin_unlock(&other->sk_receive_queue.lock); | 1218 | spin_unlock(&other->sk_receive_queue.lock); |
1220 | unix_state_unlock(other); | 1219 | unix_state_unlock(other); |
1221 | other->sk_data_ready(other, 0); | 1220 | other->sk_data_ready(other); |
1222 | sock_put(other); | 1221 | sock_put(other); |
1223 | return 0; | 1222 | return 0; |
1224 | 1223 | ||
@@ -1601,7 +1600,7 @@ restart: | |||
1601 | if (max_level > unix_sk(other)->recursion_level) | 1600 | if (max_level > unix_sk(other)->recursion_level) |
1602 | unix_sk(other)->recursion_level = max_level; | 1601 | unix_sk(other)->recursion_level = max_level; |
1603 | unix_state_unlock(other); | 1602 | unix_state_unlock(other); |
1604 | other->sk_data_ready(other, len); | 1603 | other->sk_data_ready(other); |
1605 | sock_put(other); | 1604 | sock_put(other); |
1606 | scm_destroy(siocb->scm); | 1605 | scm_destroy(siocb->scm); |
1607 | return len; | 1606 | return len; |
@@ -1707,7 +1706,7 @@ static int unix_stream_sendmsg(struct kiocb *kiocb, struct socket *sock, | |||
1707 | if (max_level > unix_sk(other)->recursion_level) | 1706 | if (max_level > unix_sk(other)->recursion_level) |
1708 | unix_sk(other)->recursion_level = max_level; | 1707 | unix_sk(other)->recursion_level = max_level; |
1709 | unix_state_unlock(other); | 1708 | unix_state_unlock(other); |
1710 | other->sk_data_ready(other, size); | 1709 | other->sk_data_ready(other); |
1711 | sent += size; | 1710 | sent += size; |
1712 | } | 1711 | } |
1713 | 1712 | ||
@@ -1788,8 +1787,11 @@ static int unix_dgram_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1788 | goto out; | 1787 | goto out; |
1789 | 1788 | ||
1790 | err = mutex_lock_interruptible(&u->readlock); | 1789 | err = mutex_lock_interruptible(&u->readlock); |
1791 | if (err) { | 1790 | if (unlikely(err)) { |
1792 | err = sock_intr_errno(sock_rcvtimeo(sk, noblock)); | 1791 | /* recvmsg() in non blocking mode is supposed to return -EAGAIN |
1792 | * sk_rcvtimeo is not honored by mutex_lock_interruptible() | ||
1793 | */ | ||
1794 | err = noblock ? -EAGAIN : -ERESTARTSYS; | ||
1793 | goto out; | 1795 | goto out; |
1794 | } | 1796 | } |
1795 | 1797 | ||
@@ -1914,6 +1916,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1914 | struct unix_sock *u = unix_sk(sk); | 1916 | struct unix_sock *u = unix_sk(sk); |
1915 | DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name); | 1917 | DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name); |
1916 | int copied = 0; | 1918 | int copied = 0; |
1919 | int noblock = flags & MSG_DONTWAIT; | ||
1917 | int check_creds = 0; | 1920 | int check_creds = 0; |
1918 | int target; | 1921 | int target; |
1919 | int err = 0; | 1922 | int err = 0; |
@@ -1929,7 +1932,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1929 | goto out; | 1932 | goto out; |
1930 | 1933 | ||
1931 | target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); | 1934 | target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); |
1932 | timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); | 1935 | timeo = sock_rcvtimeo(sk, noblock); |
1933 | 1936 | ||
1934 | /* Lock the socket to prevent queue disordering | 1937 | /* Lock the socket to prevent queue disordering |
1935 | * while sleeps in memcpy_tomsg | 1938 | * while sleeps in memcpy_tomsg |
@@ -1941,8 +1944,11 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
1941 | } | 1944 | } |
1942 | 1945 | ||
1943 | err = mutex_lock_interruptible(&u->readlock); | 1946 | err = mutex_lock_interruptible(&u->readlock); |
1944 | if (err) { | 1947 | if (unlikely(err)) { |
1945 | err = sock_intr_errno(timeo); | 1948 | /* recvmsg() in non blocking mode is supposed to return -EAGAIN |
1949 | * sk_rcvtimeo is not honored by mutex_lock_interruptible() | ||
1950 | */ | ||
1951 | err = noblock ? -EAGAIN : -ERESTARTSYS; | ||
1946 | goto out; | 1952 | goto out; |
1947 | } | 1953 | } |
1948 | 1954 | ||