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().

Change-Id: I83bb7f0a15db8d2202a010b75ade98f80e7270f2
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>
This commit is contained in:
Al Viro 2015-05-08 22:53:15 -04:00 committed by Artem Borisov
parent 83c1f7b47f
commit 9332955257

View file

@ -3062,7 +3062,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
if (unlikely(file->f_flags & __O_TMPFILE)) { if (unlikely(file->f_flags & __O_TMPFILE)) {
error = do_tmpfile(dfd, pathname, nd, flags, op, file, &opened); 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); error = path_init(dfd, pathname->name, flags | LOOKUP_PARENT, nd, &base);
@ -3100,6 +3100,7 @@ out:
path_put(&nd->root); path_put(&nd->root);
if (base) if (base)
fput(base); fput(base);
out2:
if (!(opened & FILE_OPENED)) { if (!(opened & FILE_OPENED)) {
BUG_ON(!error); BUG_ON(!error);
put_filp(file); put_filp(file);