diff options
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 433f287ee548..06430598cf51 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -305,7 +305,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i) | |||
305 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { | 305 | &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { |
306 | struct dentry *dentry = unix_sk(s)->path.dentry; | 306 | struct dentry *dentry = unix_sk(s)->path.dentry; |
307 | 307 | ||
308 | if (dentry && dentry->d_inode == i) { | 308 | if (dentry && d_backing_inode(dentry) == i) { |
309 | sock_hold(s); | 309 | sock_hold(s); |
310 | goto found; | 310 | goto found; |
311 | } | 311 | } |
@@ -778,7 +778,7 @@ static struct sock *unix_find_other(struct net *net, | |||
778 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); | 778 | err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); |
779 | if (err) | 779 | if (err) |
780 | goto fail; | 780 | goto fail; |
781 | inode = path.dentry->d_inode; | 781 | inode = d_backing_inode(path.dentry); |
782 | err = inode_permission(inode, MAY_WRITE); | 782 | err = inode_permission(inode, MAY_WRITE); |
783 | if (err) | 783 | if (err) |
784 | goto put_fail; | 784 | goto put_fail; |
@@ -839,7 +839,7 @@ static int unix_mknod(const char *sun_path, umode_t mode, struct path *res) | |||
839 | */ | 839 | */ |
840 | err = security_path_mknod(&path, dentry, mode, 0); | 840 | err = security_path_mknod(&path, dentry, mode, 0); |
841 | if (!err) { | 841 | if (!err) { |
842 | err = vfs_mknod(path.dentry->d_inode, dentry, mode, 0); | 842 | err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0); |
843 | if (!err) { | 843 | if (!err) { |
844 | res->mnt = mntget(path.mnt); | 844 | res->mnt = mntget(path.mnt); |
845 | res->dentry = dget(dentry); | 845 | res->dentry = dget(dentry); |
@@ -905,7 +905,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
905 | goto out_up; | 905 | goto out_up; |
906 | } | 906 | } |
907 | addr->hash = UNIX_HASH_SIZE; | 907 | addr->hash = UNIX_HASH_SIZE; |
908 | hash = path.dentry->d_inode->i_ino & (UNIX_HASH_SIZE-1); | 908 | hash = d_backing_inode(path.dentry)->i_ino & (UNIX_HASH_SIZE-1); |
909 | spin_lock(&unix_table_lock); | 909 | spin_lock(&unix_table_lock); |
910 | u->path = path; | 910 | u->path = path; |
911 | list = &unix_socket_table[hash]; | 911 | list = &unix_socket_table[hash]; |
@@ -1880,6 +1880,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo, | |||
1880 | unix_state_unlock(sk); | 1880 | unix_state_unlock(sk); |
1881 | timeo = freezable_schedule_timeout(timeo); | 1881 | timeo = freezable_schedule_timeout(timeo); |
1882 | unix_state_lock(sk); | 1882 | unix_state_lock(sk); |
1883 | |||
1884 | if (sock_flag(sk, SOCK_DEAD)) | ||
1885 | break; | ||
1886 | |||
1883 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | 1887 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); |
1884 | } | 1888 | } |
1885 | 1889 | ||
@@ -1939,6 +1943,10 @@ static int unix_stream_recvmsg(struct socket *sock, struct msghdr *msg, | |||
1939 | struct sk_buff *skb, *last; | 1943 | struct sk_buff *skb, *last; |
1940 | 1944 | ||
1941 | unix_state_lock(sk); | 1945 | unix_state_lock(sk); |
1946 | if (sock_flag(sk, SOCK_DEAD)) { | ||
1947 | err = -ECONNRESET; | ||
1948 | goto unlock; | ||
1949 | } | ||
1942 | last = skb = skb_peek(&sk->sk_receive_queue); | 1950 | last = skb = skb_peek(&sk->sk_receive_queue); |
1943 | again: | 1951 | again: |
1944 | if (skb == NULL) { | 1952 | if (skb == NULL) { |