* [PATCH AUTOSEL 4.14 14/25] cuse: prevent clone
[not found] <20210505164051.3464020-1-sashal@kernel.org>
@ 2021-05-05 16:40 ` Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2021-05-05 16:40 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Miklos Szeredi, Sasha Levin, linux-fsdevel
From: Miklos Szeredi <mszeredi@redhat.com>
[ Upstream commit 8217673d07256b22881127bf50dce874d0e51653 ]
For cloned connections cuse_channel_release() will be called more than
once, resulting in use after free.
Prevent device cloning for CUSE, which does not make sense at this point,
and highly unlikely to be used in real life.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fuse/cuse.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/fuse/cuse.c b/fs/fuse/cuse.c
index 55db06c7c587..b15eaa9e6cd7 100644
--- a/fs/fuse/cuse.c
+++ b/fs/fuse/cuse.c
@@ -616,6 +616,8 @@ static int __init cuse_init(void)
cuse_channel_fops.owner = THIS_MODULE;
cuse_channel_fops.open = cuse_channel_open;
cuse_channel_fops.release = cuse_channel_release;
+ /* CUSE is not prepared for FUSE_DEV_IOC_CLONE */
+ cuse_channel_fops.unlocked_ioctl = NULL;
cuse_class = class_create(THIS_MODULE, "cuse");
if (IS_ERR(cuse_class))
--
2.30.2
^ permalink raw reply related [flat|nested] only message in thread