]> git.baikalelectronics.ru Git - kernel.git/commit
vsock/virtio: fix flush of works during the .remove()
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 28 Jun 2019 12:36:59 +0000 (14:36 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Jul 2019 02:09:07 +0000 (19:09 -0700)
commit9ee01a8607768e6deca0d91410b273b2eea14e39
tree8bc5871ecca3409ab4de4e17fd9b481a2f965705
parentd0696a9198c259e84e16c3c28295ce9ed64f8d69
vsock/virtio: fix flush of works during the .remove()

This patch moves the flush of works after vdev->config->del_vqs(vdev),
because we need to be sure that no workers run before to free the
'vsock' object.

Since we stopped the workers using the [tx|rx|event]_run flags,
we are sure no one is accessing the device while we are calling
vdev->config->reset(vdev), so we can safely move the workers' flush.

Before the vdev->config->del_vqs(vdev), workers can be scheduled
by VQ callbacks, so we must flush them after del_vqs(), to avoid
use-after-free of 'vsock' object.

Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/vmw_vsock/virtio_transport.c