aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/net/lib/py/utils.py
diff options
context:
space:
mode:
authorWill Deacon <[email protected]>2025-07-17 09:01:08 +0000
committerMichael S. Tsirkin <[email protected]>2025-08-01 13:11:09 +0000
commit10a886aaed293c4db3417951f396827216299e3d (patch)
treec2788616bb4e14dfed4169da71d41adb7ccf111f /tools/testing/selftests/net/lib/py/utils.py
parentvhost_net: basic in_order support (diff)
downloadkernel-10a886aaed293c4db3417951f396827216299e3d.tar.gz
kernel-10a886aaed293c4db3417951f396827216299e3d.zip
vhost/vsock: Avoid allocating arbitrarily-sized SKBs
vhost_vsock_alloc_skb() returns NULL for packets advertising a length larger than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE in the packet header. However, this is only checked once the SKB has been allocated and, if the length in the packet header is zero, the SKB may not be freed immediately. Hoist the size check before the SKB allocation so that an iovec larger than VIRTIO_VSOCK_MAX_PKT_BUF_SIZE + the header size is rejected outright. The subsequent check on the length field in the header can then simply check that the allocated SKB is indeed large enough to hold the packet. Cc: <[email protected]> Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff") Reviewed-by: Stefano Garzarella <[email protected]> Signed-off-by: Will Deacon <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
Diffstat (limited to 'tools/testing/selftests/net/lib/py/utils.py')
0 files changed, 0 insertions, 0 deletions