Skip to content

Commit

Permalink
fuse: add inode/permission checks to fileattr_get/fileattr_set
Browse files Browse the repository at this point in the history
It looks like these checks were accidentally lost during the conversion to
fileattr API.

Fixes: 72227ea ("fuse: convert to fileattr")
Cc: <[email protected]> # v5.13
Signed-off-by: Alexander Mikhalitsyn <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
  • Loading branch information
mihalicyn authored and Miklos Szeredi committed Jan 26, 2023
1 parent 06bbb76 commit 1cc4606
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/fuse/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,12 @@ static struct fuse_file *fuse_priv_ioctl_prepare(struct inode *inode)
struct fuse_mount *fm = get_fuse_mount(inode);
bool isdir = S_ISDIR(inode->i_mode);

if (!fuse_allow_current_process(fm->fc))
return ERR_PTR(-EACCES);

if (fuse_is_bad(inode))
return ERR_PTR(-EIO);

if (!S_ISREG(inode->i_mode) && !isdir)
return ERR_PTR(-ENOTTY);

Expand Down

0 comments on commit 1cc4606

Please sign in to comment.