fs: move path_put on failure out of ->follow_link
Currently the non-nd_set_link based versions of ->follow_link are expected
to do a path_put(&nd->path) on failure. This calling convention is unexpected,
undocumented and doesn't match what the nd_set_link-based instances do.
Move the path_put out of the only non-nd_set_link based ->follow_link
instance into the caller.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/fs/namei.c b/fs/namei.c
index 6b29a51..a9b94c6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -624,7 +624,7 @@
*p = dentry->d_inode->i_op->follow_link(dentry, nd);
error = PTR_ERR(*p);
if (IS_ERR(*p))
- goto out_put_link;
+ goto out_put_nd_path;
error = 0;
s = nd_get_link(nd);
@@ -646,7 +646,6 @@
out_put_nd_path:
path_put(&nd->path);
-out_put_link:
path_put(link);
return error;
}