diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-05 16:52:35 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-11 04:20:18 +0200 |
commit | cd179f4468acfda2b7e9e236dc37bba815996421 (patch) | |
tree | 52894dc6291fae92006deb92c3b3689c629c721c /fs/namei.c | |
parent | namei: fold put_link() into the failure case of complete_walk() (diff) | |
download | linux-cd179f4468acfda2b7e9e236dc37bba815996421.tar.xz linux-cd179f4468acfda2b7e9e236dc37bba815996421.zip |
namei: move bumping the refcount of link->mnt into pick_link()
update the failure cleanup in may_follow_link() to match that.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r-- | fs/namei.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c index 55283fe95245..05efcc0fc4b6 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -802,7 +802,7 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd) return 0; audit_log_link_denied("follow_link", link); - path_put_conditional(link, nd); + path_put(link); path_put(&nd->path); return -EACCES; } @@ -887,9 +887,6 @@ const char *get_link(struct nameidata *nd) BUG_ON(nd->flags & LOOKUP_RCU); - if (nd->link.mnt == nd->path.mnt) - mntget(nd->link.mnt); - last->link = nd->link; last->cookie = NULL; nd->depth++; @@ -1574,9 +1571,11 @@ static int pick_link(struct nameidata *nd, struct path *link) return -ECHILD; } } + if (link->mnt == nd->path.mnt) + mntget(link->mnt); error = nd_alloc_stack(nd); if (unlikely(error)) { - path_to_nameidata(link, nd); + path_put(link); return error; } |