diff options
author | Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com> | 2023-01-26 11:23:18 +0100 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2023-01-26 17:22:04 +0100 |
commit | 1cc4606d19e3710bfab3f6704b87ff9580493c69 (patch) | |
tree | 7033de6c56f8ec3089fa678eb9e351696bd41145 | |
parent | 06bbb761c12dd147e4499f4d7a187699c5a0391f (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>
-rw-r--r-- | fs/fuse/ioctl.c | 6 |
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); |