aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index f75f847e688d..735362c26c8e 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -315,7 +315,7 @@ static struct sock *unix_find_socket_byinode(struct inode *i)
315 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { 315 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) {
316 struct dentry *dentry = unix_sk(s)->path.dentry; 316 struct dentry *dentry = unix_sk(s)->path.dentry;
317 317
318 if (dentry && d_backing_inode(dentry) == i) { 318 if (dentry && d_real_inode(dentry) == i) {
319 sock_hold(s); 319 sock_hold(s);
320 goto found; 320 goto found;
321 } 321 }
@@ -911,7 +911,7 @@ static struct sock *unix_find_other(struct net *net,
911 err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path); 911 err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path);
912 if (err) 912 if (err)
913 goto fail; 913 goto fail;
914 inode = d_backing_inode(path.dentry); 914 inode = d_real_inode(path.dentry);
915 err = inode_permission(inode, MAY_WRITE); 915 err = inode_permission(inode, MAY_WRITE);
916 if (err) 916 if (err)
917 goto put_fail; 917 goto put_fail;
@@ -953,7 +953,7 @@ fail:
953 return NULL; 953 return NULL;
954} 954}
955 955
956static int unix_mknod(struct dentry *dentry, struct path *path, umode_t mode, 956static int unix_mknod(struct dentry *dentry, const struct path *path, umode_t mode,
957 struct path *res) 957 struct path *res)
958{ 958{
959 int err; 959 int err;
@@ -1048,7 +1048,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
1048 goto out_up; 1048 goto out_up;
1049 } 1049 }
1050 addr->hash = UNIX_HASH_SIZE; 1050 addr->hash = UNIX_HASH_SIZE;
1051 hash = d_backing_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1); 1051 hash = d_real_inode(dentry)->i_ino & (UNIX_HASH_SIZE - 1);
1052 spin_lock(&unix_table_lock); 1052 spin_lock(&unix_table_lock);
1053 u->path = u_path; 1053 u->path = u_path;
1054 list = &unix_socket_table[hash]; 1054 list = &unix_socket_table[hash];
@@ -1534,7 +1534,6 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1534{ 1534{
1535 int i; 1535 int i;
1536 unsigned char max_level = 0; 1536 unsigned char max_level = 0;
1537 int unix_sock_count = 0;
1538 1537
1539 if (too_many_unix_fds(current)) 1538 if (too_many_unix_fds(current))
1540 return -ETOOMANYREFS; 1539 return -ETOOMANYREFS;
@@ -1542,11 +1541,9 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
1542 for (i = scm->fp->count - 1; i >= 0; i--) { 1541 for (i = scm->fp->count - 1; i >= 0; i--) {
1543 struct sock *sk = unix_get_socket(scm->fp->fp[i]); 1542 struct sock *sk = unix_get_socket(scm->fp->fp[i]);
1544 1543
1545 if (sk) { 1544 if (sk)
1546 unix_sock_count++;
1547 max_level = max(max_level, 1545 max_level = max(max_level,
1548 unix_sk(sk)->recursion_level); 1546 unix_sk(sk)->recursion_level);
1549 }
1550 } 1547 }
1551 if (unlikely(max_level > MAX_RECURSION_LEVEL)) 1548 if (unlikely(max_level > MAX_RECURSION_LEVEL))
1552 return -ETOOMANYREFS; 1549 return -ETOOMANYREFS;