summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorAlexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>2023-01-26 11:23:18 +0100
committerMiklos Szeredi <mszeredi@redhat.com>2023-01-26 17:22:04 +0100
commit1cc4606d19e3710bfab3f6704b87ff9580493c69 (patch)
tree7033de6c56f8ec3089fa678eb9e351696bd41145 /fs/fuse
parent06bbb761c12dd147e4499f4d7a187699c5a0391f (diff)
fuse: add inode/permission checks to fileattr_get/fileattr_set
It looks like these checks were accidentally lost during the conversion to fileattr API. Fixes: 72227eac177d ("fuse: convert to fileattr") Cc: <stable@vger.kernel.org> # v5.13 Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index fcce94ace2c2..8ba1545e01f9 100644
--- a/fs/fuse/ioctl.c
+++ b/fs/fuse/ioctl.c
@@ -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);