linux/net/vmw_vsock
Stefano Garzarella 3a3e3d90cb vsock/virtio: fix empty payload in tap skb for non-linear buffers
For non-linear skbs, virtio_transport_build_skb() goes through
virtio_transport_copy_nonlinear_skb() to copy the original payload
in the new skb to be delivered to the vsockmon tap device.
This manually initializes an iov_iter but does not set iov_iter.count.
Since the iov_iter is zero-initialized, the copy length is zero and no
payload is actually copied to the monitor interface, leaving data
un-initialized.

Fix this by removing the linear vs non-linear split and using
skb_copy_datagram_iter() with iov_iter_kvec() for all cases, as
vhost-vsock already does. This handles both linear and non-linear skbs,
properly initializes the iov_iter, and removes the now unused
virtio_transport_copy_nonlinear_skb().

While touching this code, let's also check the return value of
skb_copy_datagram_iter(), even though it's unlikely to fail.

Fixes: 4b0bf10eb0 ("vsock/virtio: non-linear skb handling for tap")
Reported-by: Yiqi Sun <sunyiqixm@gmail.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
Reviewed-by: Arseniy Krasnov <avkrasnov@rulkc.org>
Link: https://patch.msgid.link/20260508164411.261440-3-sgarzare@redhat.com
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-05-12 12:52:15 +02:00
..
af_vsock_tap.c
af_vsock.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-04-14 12:04:00 -07:00
diag.c sock_diag: add module pointer to "struct sock_diag_handler" 2024-01-23 15:13:54 +01:00
hyperv_transport.c hv_sock: fix ARM64 support 2026-04-29 17:30:45 -07:00
Kconfig Drivers: hv: Add CONFIG_HYPERV_VMBUS option 2025-10-01 00:00:42 +00:00
Makefile vsock: support sockmap 2023-03-29 08:19:38 +01:00
virtio_transport_common.c vsock/virtio: fix empty payload in tap skb for non-linear buffers 2026-05-12 12:52:15 +02:00
virtio_transport.c vsock: add G2H fallback for CIDs not owned by H2G transport 2026-03-12 10:59:36 +01:00
vmci_transport_notify_qstate.c
vmci_transport_notify.c
vmci_transport_notify.h
vmci_transport.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vmci_transport.h vsock: Remove unused function declarations 2023-07-31 14:41:08 -07:00
vsock_addr.c net: Convert proto_ops connect() callbacks to use sockaddr_unsized 2025-11-04 19:10:32 -08:00
vsock_bpf.c net: remove addr_len argument of recvmsg() handlers 2026-03-02 18:17:17 -08:00
vsock_loopback.c vsock: add netns support to virtio transports 2026-01-27 10:45:38 +01:00