Skip to content

Commit f15133d

Browse files
author
Al Viro
committed
path_openat(): fix double fput()
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>
1 parent 766c4cb commit f15133d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/namei.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3233,7 +3233,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
32333233

32343234
if (unlikely(file->f_flags & __O_TMPFILE)) {
32353235
error = do_tmpfile(dfd, pathname, nd, flags, op, file, &opened);
3236-
goto out;
3236+
goto out2;
32373237
}
32383238

32393239
error = path_init(dfd, pathname, flags, nd);
@@ -3263,6 +3263,7 @@ static struct file *path_openat(int dfd, struct filename *pathname,
32633263
}
32643264
out:
32653265
path_cleanup(nd);
3266+
out2:
32663267
if (!(opened & FILE_OPENED)) {
32673268
BUG_ON(!error);
32683269
put_filp(file);

0 commit comments

Comments
 (0)