diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-08 22:53:15 -0400 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2015-05-23 15:51:51 -0400 |
commit | f42b455331b5eb2ef5f2cecab28941eb1fada554 (patch) | |
tree | 6bf5ff660ace51d55912addf1228344f1e69f4ed /fs/namei.c | |
parent | d7259f44da869f67b40a91efe4dea3580462d305 (diff) | |
download | lwn-f42b455331b5eb2ef5f2cecab28941eb1fada554.tar.gz lwn-f42b455331b5eb2ef5f2cecab28941eb1fada554.zip |
path_openat(): fix double fput()
[ Upstream commit f15133df088ecadd141ea1907f2c96df67c729f0 ]
path_openat() jumps to the wrong place after do_tmpfile() - it has
already done path_cleanup() (as part of path_lookupat() called by
do_tmpfile()), so doing that again can lead to double fput().
Cc: stable@vger.kernel.org # v3.11+
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c index 890d3580bf0e..d20f061cddd3 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3197,7 +3197,7 @@ static struct file *path_openat(int dfd, struct filename *pathname, if (unlikely(file->f_flags & __O_TMPFILE)) { error = do_tmpfile(dfd, pathname, nd, flags, op, file, &opened); - goto out; + goto out2; } error = path_init(dfd, pathname->name, flags | LOOKUP_PARENT, nd, &base); @@ -3235,6 +3235,7 @@ out: path_put(&nd->root); if (base) fput(base); +out2: if (!(opened & FILE_OPENED)) { BUG_ON(!error); put_filp(file); |