OSDN Git Service

virtio/vsock: fix leaks due to missing skb owner
authorBobby Eshleman <bobby.eshleman@bytedance.com>
Wed, 29 Mar 2023 16:51:58 +0000 (16:51 +0000)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Mar 2023 07:58:13 +0000 (08:58 +0100)
commitf9d2b1e146e0f82f3d04629afd92698522058361
tree888c3af527b7ce0888705db09ba6a029fd9f94b6
parent6b36d68cc9bb1fc85bbe54ebe2eb6b2c3beec73d
virtio/vsock: fix leaks due to missing skb owner

This patch sets the skb owner in the recv and send path for virtio.

For the send path, this solves the leak caused when
virtio_transport_purge_skbs() finds skb->sk is always NULL and therefore
never matches it with the current socket. Setting the owner upon
allocation fixes this.

For the recv path, this ensures correctness of accounting and also
correct transfer of ownership in vsock_loopback (when skbs are sent from
one socket and received by another).

Fixes: 71dc9ec9ac7d ("virtio/vsock: replace virtio_vsock_pkt with sk_buff")
Signed-off-by: Bobby Eshleman <bobby.eshleman@bytedance.com>
Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
Link: https://lore.kernel.org/all/ZCCbATwov4U+GBUv@pop-os.localdomain/
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/virtio_transport_common.c