Skip to content

Commit 30814d4

Browse files
amir73ilgregkh
authored andcommitted
fuse: do not allow mapping a non-regular backing file
commit e9c8da6 upstream. We do not support passthrough operations other than read/write on regular file, so allowing non-regular backing files makes no sense. Fixes: efad715 ("fuse: allow O_PATH fd for FUSE_DEV_IOC_BACKING_OPEN") Cc: stable@vger.kernel.org Signed-off-by: Amir Goldstein <amir73il@gmail.com> Reviewed-by: Bernd Schubert <bschubert@ddn.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b6f8cd7 commit 30814d4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/fuse/passthrough.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,11 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
233233
if (!file)
234234
goto out;
235235

236+
/* read/write/splice/mmap passthrough only relevant for regular files */
237+
res = d_is_dir(file->f_path.dentry) ? -EISDIR : -EINVAL;
238+
if (!d_is_reg(file->f_path.dentry))
239+
goto out_fput;
240+
236241
backing_sb = file_inode(file)->i_sb;
237242
res = -ELOOP;
238243
if (backing_sb->s_stack_depth >= fc->max_stack_depth)

0 commit comments

Comments
 (0)