Skip to content

Commit e9c8da6

Browse files
amir73ilMiklos Szeredi
authored andcommitted
fuse: do not allow mapping a non-regular backing file
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>
1 parent 1b237f1 commit e9c8da6

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
@@ -237,6 +237,11 @@ int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map)
237237
if (!file)
238238
goto out;
239239

240+
/* read/write/splice/mmap passthrough only relevant for regular files */
241+
res = d_is_dir(file->f_path.dentry) ? -EISDIR : -EINVAL;
242+
if (!d_is_reg(file->f_path.dentry))
243+
goto out_fput;
244+
240245
backing_sb = file_inode(file)->i_sb;
241246
res = -ELOOP;
242247
if (backing_sb->s_stack_depth >= fc->max_stack_depth)

0 commit comments

Comments
 (0)