Skip to content

Commit

Permalink
autofs: fix missing fput for FSCONFIG_SET_FD
Browse files Browse the repository at this point in the history
[ Upstream commit 6a64c52 ]

If you pass an fd using FSCONFIG_SET_FD, autofs_parse_fd() "steals" the
param->file and so the fs_context infrastructure will not do fput() for
us.

Fixes: e6ec453 ("autofs: convert autofs to use the new mount api")
Signed-off-by: Aleksa Sarai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Christian Brauner <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
cyphar authored and gregkh committed Oct 2, 2024
1 parent 2619680 commit fe1e07e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/autofs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ static int autofs_parse_fd(struct fs_context *fc, struct autofs_sb_info *sbi,
ret = autofs_check_pipe(pipe);
if (ret < 0) {
errorf(fc, "Invalid/unusable pipe");
if (param->type != fs_value_is_file)
fput(pipe);
fput(pipe);
return -EBADF;
}

Expand Down

0 comments on commit fe1e07e

Please sign in to comment.