Skip to content

Commit

Permalink
path_openat(): fix double fput()
Browse files Browse the repository at this point in the history
[ 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: [email protected]	# v3.11+
Signed-off-by: Al Viro <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Al Viro authored and ciyanogen committed Apr 26, 2021
1 parent afb655e commit 114238d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,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);
Expand Down

0 comments on commit 114238d

Please sign in to comment.