[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221202225818.3934909-1-artem.chernyshev@red-soft.ru>
Date: Sat, 3 Dec 2022 01:58:18 +0300
From: Artem Chernyshev <artem.chernyshev@...-soft.ru>
To: Bryan Tan <bryantan@...are.com>, Vishnu Dasa <vdasa@...are.com>
Cc: Artem Chernyshev <artem.chernyshev@...-soft.ru>,
VMware PV-Drivers Reviewers <pv-drivers@...are.com>,
Stefano Garzarella <sgarzare@...hat.com>,
Jakub Kicinski <kuba@...nel.org>, linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
lvc-project@...uxtesting.org
Subject: [PATCH] net: vmw_vsock: vmci: Check memcpy_from_msg()
We returns from vmci_transport_dgram_enqueue() with error
if memcpy goes wrong
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 0f7db23a07af ("vmci_transport: switch ->enqeue_dgram, ->enqueue_stream and ->dequeue_stream to msghdr")
Signed-off-by: Artem Chernyshev <artem.chernyshev@...-soft.ru>
---
net/vmw_vsock/vmci_transport.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
index 842c94286d31..7994090e0314 100644
--- a/net/vmw_vsock/vmci_transport.c
+++ b/net/vmw_vsock/vmci_transport.c
@@ -1711,7 +1711,8 @@ static int vmci_transport_dgram_enqueue(
if (!dg)
return -ENOMEM;
- memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
+ if (memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len))
+ return -EFAULT;
dg->dst = vmci_make_handle(remote_addr->svm_cid,
remote_addr->svm_port);
--
2.30.3
Powered by blists - more mailing lists