diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-05-08 22:53:15 -0400 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-08-25 16:57:04 +0200 |
commit | da59de4cfa5f3562d02fcbc24fe96a08aebea628 (patch) | |
tree | f92370d791c9ac805b01c290aa6056a299dbcd1b | |
parent | 425703586ddf864d5d88ab2ee93d130303bea541 (diff) | |
download | lwn-da59de4cfa5f3562d02fcbc24fe96a08aebea628.tar.gz lwn-da59de4cfa5f3562d02fcbc24fe96a08aebea628.zip |
path_openat(): fix double fput()
commit f15133df088ecadd141ea1907f2c96df67c729f0 upstream.
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().
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-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 c0c78e193e2a..097bbeac8c66 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3202,7 +3202,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); @@ -3240,6 +3240,7 @@ out: path_put(&nd->root); if (base) fput(base); +out2: if (!(opened & FILE_OPENED)) { BUG_ON(!error); put_filp(file); |