net: vmw_vsock: vmci: Check memcpy_from_msg()
authorArtem Chernyshev <artem.chernyshev@red-soft.ru>
Tue, 6 Dec 2022 06:58:34 +0000 (09:58 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:26 +0000 (13:32 +0100)
commit6af94424012cb56d7c21479aab876f78f3d9e2cf
treef4cc555a33e7518d5038d5cf22cad01dcd1e579a
parentbd72ab5e6fc1c4d3e6b84636141d26a41b977b03
net: vmw_vsock: vmci: Check memcpy_from_msg()

[ Upstream commit 44aa5a6dba8283bfda28b1517af4de711c5652a4 ]

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: 0f7db23a07af ("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: Sasha Levin <sashal@kernel.org>
net/vmw_vsock/vmci_transport.c