diff mbox series

fuse: add inode/permission checks to fileattr_get/fileattr_set

Message ID 20230126102318.177838-1-aleksandr.mikhalitsyn@canonical.com (mailing list archive)
State New, archived
Headers show
Series fuse: add inode/permission checks to fileattr_get/fileattr_set | expand

Commit Message

Aleksandr Mikhalitsyn Jan. 26, 2023, 10:23 a.m. UTC
It looks like these checks were accidentally lost during the
conversion to fileattr API.

Fixes: 72227eac177d ("fuse: convert to fileattr")
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>
---
 fs/fuse/ioctl.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Miklos Szeredi Jan. 26, 2023, 4:22 p.m. UTC | #1
On Thu, 26 Jan 2023 at 11:23, Alexander Mikhalitsyn
<aleksandr.mikhalitsyn@canonical.com> wrote:
>
> It looks like these checks were accidentally lost during the
> conversion to fileattr API.
>
> Fixes: 72227eac177d ("fuse: convert to fileattr")
> Cc: Miklos Szeredi <miklos@szeredi.hu>
> Cc: Alexander Mikhalitsyn <alexander@mihalicyn.com>
> Cc: linux-fsdevel@vger.kernel.org
> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn@canonical.com>

Applied, thanks.

Miklos
diff mbox series

Patch

diff --git a/fs/fuse/ioctl.c b/fs/fuse/ioctl.c
index 61d8afcb10a3..d2cd3469b9cc 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);