aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-05-08 22:53:15 -0400
committerjro1979oliver <jroliveira.oliveira301@gmail.com>2020-09-15 10:09:28 -0300
commit989bc4495cd0952cc9adec8c56ea8ebc2b660927 (patch)
treede654ffe8140aed0915bd99b355046ef552aed5a
parentbfc0350f6af52cd4fc447d2c2b2aea325f908b07 (diff)
path_openat(): fix double fput()r11.1_msm8916q10.0_msm8916
[ 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: Ia74c130ae5e379b512532c0feebea871b5f73668 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>
-rw-r--r--fs/namei.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 71d565ff814..89bbfcbb2ea 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3059,7 +3059,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);
@@ -3097,6 +3097,7 @@ out:
path_put(&nd->root);
if (base)
fput(base);
+out2:
if (!(opened & FILE_OPENED)) {
BUG_ON(!error);
put_filp(file);