kernel_optimize_test/net/vmw_vsock
Stefano Garzarella b605673b52 vsock/virtio: free queued packets when closing socket
[ Upstream commit 8432b8114957235f42e070a16118a7f750de9d39 ]

As reported by syzbot [1], there is a memory leak while closing the
socket. We partially solved this issue with commit ac03046ece
("vsock/virtio: free packets during the socket release"), but we
forgot to drain the RX queue when the socket is definitely closed by
the scheduled work.

To avoid future issues, let's use the new virtio_transport_remove_sock()
to drain the RX queue before removing the socket from the af_vsock lists
calling vsock_remove_sock().

[1] https://syzkaller.appspot.com/bug?extid=24452624fc4c571eedd9

Fixes: ac03046ece ("vsock/virtio: free packets during the socket release")
Reported-and-tested-by: syzbot+24452624fc4c571eedd9@syzkaller.appspotmail.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-14 09:50:41 +02:00
..
af_vsock_tap.c
af_vsock.c selinux: vsock: Set SID for socket returned by accept() 2021-03-30 14:32:03 +02:00
diag.c
hyperv_transport.c vsock: fix locking in vsock_shutdown() 2021-02-17 11:02:30 +01:00
Kconfig vsock: add vsock_loopback transport 2019-12-11 15:01:23 -08:00
Makefile vsock: add vsock_loopback transport 2019-12-11 15:01:23 -08:00
virtio_transport_common.c vsock/virtio: free queued packets when closing socket 2021-05-14 09:50:41 +02:00
virtio_transport.c vsock/virtio: annotate 'the_virtio_vsock' RCU pointer 2020-07-15 17:47:15 -07:00
vmci_transport_notify_qstate.c
vmci_transport_notify.c
vmci_transport_notify.h vsock: remove include/linux/vm_sockets.h file 2019-11-14 18:12:17 -08:00
vmci_transport.c vsock/vmci: log once the failed queue pair allocation 2021-05-14 09:50:40 +02:00
vmci_transport.h vsock: handle buffer_size sockopts in the core 2019-11-14 18:12:18 -08:00
vsock_addr.c
vsock_loopback.c vsock: add vsock_loopback transport 2019-12-11 15:01:23 -08:00