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

Konstantin Khorenko khorenko at virtuozzo.com
Tue Sep 24 15:52:54 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-427.33.1.vz9.72.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.33.1.vz9.72.3
------>
commit 56543f1eda4a9a8ff86e873b5c3b663af7e123ea
Author: Liu Kui <kui.liu at virtuozzo.com>
Date:   Tue Sep 24 18:08:42 2024 +0800

    fs/fuse kio: fixed a bug in krpc recv msg
    
    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
    Fixes: 46c678d63e42 ("fs/fuse kio: implement pcs_krpc - export kernel RPC to
    userspace")
    
    Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
    Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
    
    Feature: fuse: kRPC - single RPC for kernel and userspace
---
 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)))


More information about the Devel mailing list