Add missing unlocks to error paths of mountpoint_last.
authorDave Jones <davej@redhat.com>
Tue, 10 Sep 2013 21:04:25 +0000 (17:04 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 10 Sep 2013 22:56:29 +0000 (18:56 -0400)
Signed-off-by: Dave Jones <davej@fedoraproject.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c

index 841c8d9..0dc4cbf 100644 (file)
@@ -2261,12 +2261,15 @@ mountpoint_last(struct nameidata *nd, struct path *path)
                dentry = d_alloc(dir, &nd->last);
                if (!dentry) {
                        error = -ENOMEM;
+                       mutex_unlock(&dir->d_inode->i_mutex);
                        goto out;
                }
                dentry = lookup_real(dir->d_inode, dentry, nd->flags);
                error = PTR_ERR(dentry);
-               if (IS_ERR(dentry))
+               if (IS_ERR(dentry)) {
+                       mutex_unlock(&dir->d_inode->i_mutex);
                        goto out;
+               }
        }
        mutex_unlock(&dir->d_inode->i_mutex);