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 /fs/fuse | |
parent | 06bbb761c12dd147e4499f4d7a187699c5a0391f (diff) | |
download | lwn-1cc4606d19e3710bfab3f6704b87ff9580493c69.tar.gz lwn-1cc4606d19e3710bfab3f6704b87ff9580493c69.zip |
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.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); |