[Devel] [PATCH VZ9] fs/fuse kio: fixed a bug in krpc recv msg

Liu Kui kui.liu at virtuozzo.com
Tue Sep 24 13:08:42 MSK 2024


An uninitialized local variable is passed to a function and used
there, which of course crashes kernel. Fixed here.

https://virtuozzo.atlassian.net/browse/VSTOR-92924

Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_krpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c
index f62bf6ef11aa..0ef33b730204 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.c
+++ b/fs/fuse/kio/pcs/pcs_krpc.c
@@ -563,6 +563,9 @@ static long pcs_krpc_ioctl(struct file *file, unsigned int cmd, unsigned long ar
 	case PCS_KRPC_IOC_RECV_MSG: {
 		struct pcs_krpc_ioc_recvmsg req;
 
+		if (copy_from_user(&req, (void __user *)arg, sizeof(req)))
+			return -EFAULT;
+
 		res = pcs_krpc_ioctl_recv_msg(krpc, &req);
 
 		if (copy_to_user((void __user *)arg, &req, sizeof(req)))
-- 
2.39.3 (Apple Git-146)



More information about the Devel mailing list