Skip to content

Commit e5f5248

Browse files
net: vmw_vsock: vmci: Check memcpy_from_msg()
Bugzilla: https://bugzilla.redhat.com/2160028 commit 44aa5a6 Author: Artem Chernyshev <artem.chernyshev@red-soft.ru> Date: Tue Dec 6 09:58:34 2022 +0300 net: vmw_vsock: vmci: Check memcpy_from_msg() vmci_transport_dgram_enqueue() does not check the return value of memcpy_from_msg(). If memcpy_from_msg() fails, it is possible that uninitialized memory contents are sent unintentionally instead of user's message in the datagram to the destination. Return with an error if memcpy_from_msg() fails. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 0f7db23 ("vmci_transport: switch ->enqeue_dgram, ->enqueue_stream and ->dequeue_stream to msghdr") Signed-off-by: Artem Chernyshev <artem.chernyshev@red-soft.ru> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Reviewed-by: Vishnu Dasa <vdasa@vmware.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
1 parent 898e9af commit e5f5248

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/vmw_vsock/vmci_transport.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1711,7 +1711,11 @@ static int vmci_transport_dgram_enqueue(
17111711
if (!dg)
17121712
return -ENOMEM;
17131713

1714-
memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
1714+
err = memcpy_from_msg(VMCI_DG_PAYLOAD(dg), msg, len);
1715+
if (err) {
1716+
kfree(dg);
1717+
return err;
1718+
}
17151719

17161720
dg->dst = vmci_make_handle(remote_addr->svm_cid,
17171721
remote_addr->svm_port);

0 commit comments

Comments
 (0)