diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-02-28 03:23:16 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-03-04 02:07:13 +0300 |
commit | aaf1569ce4575ed163839002f27da2cde4d10a77 (patch) | |
tree | 0a08aa47fdd875d8dc66c8a31f00495728096219 /fs/namei.c | |
parent | a007fc3d6569b620ec5bca1b4636d952ebdd2627 (diff) | |
download | linux-aaf1569ce4575ed163839002f27da2cde4d10a77.tar.xz |
namei: ->d_inode of a pinned dentry is stable only for positives
commit d4565649b6d6923369112758212b851adc407f0c upstream.
both do_last() and walk_component() risk picking a NULL inode out
of dentry about to become positive, *then* checking its flags and
seeing that it's not negative anymore and using (already stale by
then) value they'd fetched earlier. Usually ends up oopsing soon
after that...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/namei.c b/fs/namei.c index 0c3974cd3ecd..c9eb7e84d05f 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -1742,11 +1742,11 @@ static int walk_component(struct nameidata *nd, int flags) if (err < 0) return err; - inode = d_backing_inode(path.dentry); seq = 0; /* we are already out of RCU mode */ err = -ENOENT; if (d_is_negative(path.dentry)) goto out_path_put; + inode = d_backing_inode(path.dentry); } if (flags & WALK_PUT) @@ -3130,12 +3130,12 @@ retry_lookup: return error; BUG_ON(nd->flags & LOOKUP_RCU); - inode = d_backing_inode(path.dentry); seq = 0; /* out of RCU mode, so the value doesn't matter */ if (unlikely(d_is_negative(path.dentry))) { path_to_nameidata(&path, nd); return -ENOENT; } + inode = d_backing_inode(path.dentry); finish_lookup: if (nd->depth) put_link(nd); |