linux-stable/net/vmw_vsock
Stefano Garzarella e238e05ec2 vsock/virtio: fix sock refcnt holding during the shutdown
[ Upstream commit ad8a722035 ]

The "42f5cda5eaf4" commit rightly set SOCK_DONE on peer shutdown,
but there is an issue if we receive the SHUTDOWN(RDWR) while the
virtio_transport_close_timeout() is scheduled.
In this case, when the timeout fires, the SOCK_DONE is already
set and the virtio_transport_close_timeout() will not call
virtio_transport_reset() and virtio_transport_do_close().
This causes that both sockets remain open and will never be released,
preventing the unloading of [virtio|vhost]_transport modules.

This patch fixes this issue, calling virtio_transport_reset() and
virtio_transport_do_close() when we receive the SHUTDOWN(RDWR)
and there is nothing left to read.

Fixes: 42f5cda5ea ("vsock/virtio: set SOCK_DONE on peer shutdown")
Cc: Stephen Barber <smbarber@chromium.org>
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>
2019-11-12 19:21:22 +01:00
..
af_vsock.c net: use skb_queue_empty_lockless() in poll() handlers 2019-11-10 11:27:48 +01:00
af_vsock_tap.c VSOCK: Add vsockmon tap functions 2017-04-24 12:35:56 -04:00
diag.c VSOCK: add sock_diag interface 2017-10-05 18:44:17 -07:00
hyperv_transport.c vsock: Fix a lockdep warning in __vsock_release() 2019-10-07 18:57:23 +02:00
Kconfig VSOCK: add sock_diag interface 2017-10-05 18:44:17 -07:00
Makefile Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-11-04 09:26:51 +09:00
virtio_transport.c vsock/virtio: Initialize core virtio vsock before registering the driver 2019-05-25 18:23:22 +02:00
virtio_transport_common.c vsock/virtio: fix sock refcnt holding during the shutdown 2019-11-12 19:21:22 +01:00
vmci_transport.c vsock: cope with memory allocation failure at socket creation time 2019-02-23 09:07:25 +01:00
vmci_transport.h VSOCK: constify vmci_transport_notify_ops structures 2015-11-23 15:49:29 -05:00
vmci_transport_notify.c VSOCK: use TCP state constants for sk_state 2017-10-05 18:44:17 -07:00
vmci_transport_notify.h VSOCK: constify vmci_transport_notify_ops structures 2015-11-23 15:49:29 -05:00
vmci_transport_notify_qstate.c VSOCK: use TCP state constants for sk_state 2017-10-05 18:44:17 -07:00
vsock_addr.c VSOCK: Move af_vsock.h and vsock_addr.h to include/net 2013-07-27 22:14:06 -07:00