]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/unix/af_unix.c
af_unix: netns: fix problem of return value
[linux-2.6-omap-h63xx.git] / net / unix / af_unix.c
index c647aab8d418c508c9088789c847fae59745c049..4d3c6071b9a47102212bcc65afa55c640e7bb5b8 100644 (file)
@@ -711,28 +711,30 @@ static struct sock *unix_find_other(struct net *net,
                                    int type, unsigned hash, int *error)
 {
        struct sock *u;
-       struct nameidata nd;
+       struct path path;
        int err = 0;
 
        if (sunname->sun_path[0]) {
-               err = path_lookup(sunname->sun_path, LOOKUP_FOLLOW, &nd);
+               struct inode *inode;
+               err = kern_path(sunname->sun_path, LOOKUP_FOLLOW, &path);
                if (err)
                        goto fail;
-               err = vfs_permission(&nd, MAY_WRITE);
+               inode = path.dentry->d_inode;
+               err = inode_permission(inode, MAY_WRITE);
                if (err)
                        goto put_fail;
 
                err = -ECONNREFUSED;
-               if (!S_ISSOCK(nd.path.dentry->d_inode->i_mode))
+               if (!S_ISSOCK(inode->i_mode))
                        goto put_fail;
-               u = unix_find_socket_byinode(net, nd.path.dentry->d_inode);
+               u = unix_find_socket_byinode(net, inode);
                if (!u)
                        goto put_fail;
 
                if (u->sk_type == type)
-                       touch_atime(nd.path.mnt, nd.path.dentry);
+                       touch_atime(path.mnt, path.dentry);
 
-               path_put(&nd.path);
+               path_put(&path);
 
                err=-EPROTOTYPE;
                if (u->sk_type != type) {
@@ -753,7 +755,7 @@ static struct sock *unix_find_other(struct net *net,
        return u;
 
 put_fail:
-       path_put(&nd.path);
+       path_put(&path);
 fail:
        *error=err;
        return NULL;
@@ -2211,7 +2213,7 @@ static int unix_net_init(struct net *net)
 #endif
        error = 0;
 out:
-       return 0;
+       return error;
 }
 
 static void unix_net_exit(struct net *net)