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.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index c647aab8d418..dc504d308ec0 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -711,28 +711,30 @@ static struct sock *unix_find_other(struct net *net,
711 int type, unsigned hash, int *error) 711 int type, unsigned hash, int *error)
712{ 712{
713 struct sock *u; 713 struct sock *u;
714 struct nameidata nd; 714 struct path path;
715 int err = 0; 715 int err = 0;
716 716
717 if (sunname->sun_path[0]) { 717 if (sunname->sun_path[0]) {
718 err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd); 718 struct inode *inode;
719 err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path);
719 if (err) 720 if (err)
720 goto fail; 721 goto fail;
721 err = vfs_permission(&nd, MAY_WRITE); 722 inode = path.dentry->d_inode;
723 err = inode_permission(inode, MAY_WRITE);
722 if (err) 724 if (err)
723 goto put_fail; 725 goto put_fail;
724 726
725 err = -ECONNREFUSED; 727 err = -ECONNREFUSED;
726 if (!S_ISSOCK(nd.path.dentry->d_inode->i_mode)) 728 if (!S_ISSOCK(inode->i_mode))
727 goto put_fail; 729 goto put_fail;
728 u = unix_find_socket_byinode(net, nd.path.dentry->d_inode); 730 u = unix_find_socket_byinode(net, inode);
729 if (!u) 731 if (!u)
730 goto put_fail; 732 goto put_fail;
731 733
732 if (u->sk_type == type) 734 if (u->sk_type == type)
733 touch_atime(nd.path.mnt, nd.path.dentry); 735 touch_atime(path.mnt, path.dentry);
734 736
735 path_put(&nd.path); 737 path_put(&path);
736 738
737 err=-EPROTOTYPE; 739 err=-EPROTOTYPE;
738 if (u->sk_type != type) { 740 if (u->sk_type != type) {
@@ -753,7 +755,7 @@ static struct sock *unix_find_other(struct net *net,
753 return u; 755 return u;
754 756
755put_fail: 757put_fail:
756 path_put(&nd.path); 758 path_put(&path);
757fail: 759fail:
758 *error=err; 760 *error=err;
759 return NULL; 761 return NULL;