diff options
author | Christoph Hellwig <hch@infradead.org> | 2012-06-18 10:47:03 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:35:35 -0400 |
commit | 408ef013cc9e2f94a14f7ccbbe52ddfb18437a99 (patch) | |
tree | 3168e06e8090210a59af788ca97cd40d87b5282e /fs/proc | |
parent | ac481d6ca4081bdd348cbd84963d1ece843a3407 (diff) |
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>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 8eaa5ea1c613..3bd5ac1ff018 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1427,16 +1427,20 @@ static int proc_exe_link(struct dentry *dentry, struct path *exe_path) | |||
1427 | static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) | 1427 | static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) |
1428 | { | 1428 | { |
1429 | struct inode *inode = dentry->d_inode; | 1429 | struct inode *inode = dentry->d_inode; |
1430 | struct path path; | ||
1430 | int error = -EACCES; | 1431 | int error = -EACCES; |
1431 | 1432 | ||
1432 | /* We don't need a base pointer in the /proc filesystem */ | ||
1433 | path_put(&nd->path); | ||
1434 | |||
1435 | /* Are we allowed to snoop on the tasks file descriptors? */ | 1433 | /* Are we allowed to snoop on the tasks file descriptors? */ |
1436 | if (!proc_fd_access_allowed(inode)) | 1434 | if (!proc_fd_access_allowed(inode)) |
1437 | goto out; | 1435 | goto out; |
1438 | 1436 | ||
1439 | error = PROC_I(inode)->op.proc_get_link(dentry, &nd->path); | 1437 | error = PROC_I(inode)->op.proc_get_link(dentry, &path); |
1438 | if (error) | ||
1439 | goto out; | ||
1440 | |||
1441 | path_put(&nd->path); | ||
1442 | nd->path = path; | ||
1443 | return NULL; | ||
1440 | out: | 1444 | out: |
1441 | return ERR_PTR(error); | 1445 | return ERR_PTR(error); |
1442 | } | 1446 | } |