* [PATCH] fuse: do not allow mapping a non-regular backing file
@ 2025-07-10 10:08 Amir Goldstein
2025-07-10 22:43 ` Bernd Schubert
0 siblings, 1 reply; 2+ messages in thread
From: Amir Goldstein @ 2025-07-10 10:08 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: Bernd Schubert, linux-fsdevel
We do not support passthrough operations other than read/write on
regular file, so allowing non-regular backing files makes no sense.
Fixes: efad7153bf93 ("fuse: allow O_PATH fd for FUSE_DEV_IOC_BACKING_OPEN")
Cc: <stable@vger.kernel.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
Miklos,
While working on readdir passthrough, I realized that we accidentrly
allowed creating backing fds for non-regular files.
This needs to go to stable kernels IMO.
Thanks,
Amir.
fs/fuse/passthrough.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
index 607ef735ad4a..eb97ac009e75 100644
--- a/fs/fuse/passthrough.c
+++ b/fs/fuse/passthrough.c
@@ -237,6 +237,11 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
if (!file)
goto out;
+ /* read/write/splice/mmap passthrough only relevant for regular files */
+ res = d_is_dir(file->f_path.dentry) ? -EISDIR : -EINVAL;
+ if (!d_is_reg(file->f_path.dentry))
+ goto out_fput;
+
backing_sb = file_inode(file)->i_sb;
res = -ELOOP;
if (backing_sb->s_stack_depth >= fc->max_stack_depth)
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fuse: do not allow mapping a non-regular backing file
2025-07-10 10:08 [PATCH] fuse: do not allow mapping a non-regular backing file Amir Goldstein
@ 2025-07-10 22:43 ` Bernd Schubert
0 siblings, 0 replies; 2+ messages in thread
From: Bernd Schubert @ 2025-07-10 22:43 UTC (permalink / raw)
To: Amir Goldstein, Miklos Szeredi; +Cc: linux-fsdevel
On 7/10/25 12:08, Amir Goldstein wrote:
> We do not support passthrough operations other than read/write on
> regular file, so allowing non-regular backing files makes no sense.
>
> Fixes: efad7153bf93 ("fuse: allow O_PATH fd for FUSE_DEV_IOC_BACKING_OPEN")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>
> Miklos,
>
> While working on readdir passthrough, I realized that we accidentrly
> allowed creating backing fds for non-regular files.
> This needs to go to stable kernels IMO.
>
> Thanks,
> Amir.
>
> fs/fuse/passthrough.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/fuse/passthrough.c b/fs/fuse/passthrough.c
> index 607ef735ad4a..eb97ac009e75 100644
> --- a/fs/fuse/passthrough.c
> +++ b/fs/fuse/passthrough.c
> @@ -237,6 +237,11 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
> if (!file)
> goto out;
>
> + /* read/write/splice/mmap passthrough only relevant for regular files */
> + res = d_is_dir(file->f_path.dentry) ? -EISDIR : -EINVAL;
> + if (!d_is_reg(file->f_path.dentry))
> + goto out_fput;
> +
> backing_sb = file_inode(file)->i_sb;
> res = -ELOOP;
> if (backing_sb->s_stack_depth >= fc->max_stack_depth)
LGTM,
Reviewed-by: Bernd Schubert <bschubert@ddn.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-10 22:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 10:08 [PATCH] fuse: do not allow mapping a non-regular backing file Amir Goldstein
2025-07-10 22:43 ` Bernd Schubert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).