]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
autofs: fix missing fput for FSCONFIG_SET_FD
authorAleksa Sarai <cyphar@cyphar.com>
Wed, 31 Jul 2024 13:10:27 +0000 (23:10 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:37:19 +0000 (16:37 +0200)
[ Upstream commit 6a64c5220c5df235448b846aeff3c0660d4cc83e ]

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: e6ec453bd0f0 ("autofs: convert autofs to use the new mount api")
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Link: https://lore.kernel.org/r/20240731-fsconfig-fsparam_fd-fixes-v2-1-e7c472224417@cyphar.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/autofs/inode.c

index cf792d4de4f1b32cb8960cb5dcb04ae0d5e5073e..64faa6c51f60a5463bff9e9efeccf64d386f50ed 100644 (file)
@@ -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;
        }