]> git.baikalelectronics.ru Git - kernel.git/commit
vsock/virtio: fix sock refcnt holding during the shutdown
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 8 Nov 2019 16:08:50 +0000 (17:08 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Nov 2019 20:17:50 +0000 (12:17 -0800)
commitf6c040cad147921a3bc30f6b39836abd31061814
tree9801fe23b503700e860175db93a9f140d9447f30
parent764a0cd4274cb052abc9d0610097680187eb5c63
vsock/virtio: fix sock refcnt holding during the shutdown

The "e3174cdd7804" 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: e3174cdd7804 ("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>
net/vmw_vsock/virtio_transport_common.c