hv_sock: Add validation for untrusted Hyper-V values
authorAndrea Parri (Microsoft) <parri.andrea@gmail.com>
Thu, 28 Apr 2022 14:51:05 +0000 (16:51 +0200)
committerWei Liu <wei.liu@kernel.org>
Thu, 28 Apr 2022 15:01:14 +0000 (15:01 +0000)
commitdbde6d0c7a5a462a1767a07c28eadd2c3dd08fb2
treed2b87afa54493c0b2277319578fd8efbe0d151e9
parent066f3377fb663f839a961cd66e71fc1a36437657
hv_sock: Add validation for untrusted Hyper-V values

For additional robustness in the face of Hyper-V errors or malicious
behavior, validate all values that originate from packets that Hyper-V
has sent to the guest in the host-to-guest ring buffer.  Ensure that
invalid values cannot cause data being copied out of the bounds of the
source buffer in hvs_stream_dequeue().

Signed-off-by: Andrea Parri (Microsoft) <parri.andrea@gmail.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20220428145107.7878-4-parri.andrea@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
include/linux/hyperv.h
net/vmw_vsock/hyperv_transport.c