]> git.ipfire.org Git - thirdparty/linux.git/commit
vsock/virtio: cancel close work in the destructor
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 10 Jan 2025 08:35:09 +0000 (09:35 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 14 Jan 2025 11:29:37 +0000 (12:29 +0100)
commitdf137da9d6d166e87e40980e36eb8e0bc90483ef
tree4fa05d95171840f01bd675f1da0206643b515634
parentf6abafcd32f9cfc4b1a2f820ecea70773e26d423
vsock/virtio: cancel close work in the destructor

During virtio_transport_release() we can schedule a delayed work to
perform the closing of the socket before destruction.

The destructor is called either when the socket is really destroyed
(reference counter to zero), or it can also be called when we are
de-assigning the transport.

In the former case, we are sure the delayed work has completed, because
it holds a reference until it completes, so the destructor will
definitely be called after the delayed work is finished.
But in the latter case, the destructor is called by AF_VSOCK core, just
after the release(), so there may still be delayed work scheduled.

Refactor the code, moving the code to delete the close work already in
the do_close() to a new function. Invoke it during destruction to make
sure we don't leave any pending work.

Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
Cc: stable@vger.kernel.org
Reported-by: Hyunwoo Kim <v4bel@theori.io>
Closes: https://lore.kernel.org/netdev/Z37Sh+utS+iV3+eb@v4bel-B760M-AORUS-ELITE-AX/
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
Tested-by: Hyunwoo Kim <v4bel@theori.io>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
net/vmw_vsock/virtio_transport_common.c