]> git.baikalelectronics.ru Git - kernel.git/commit
vsock/virtio: fix flush of works during the .remove()
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 5 Jul 2019 11:04:54 +0000 (13:04 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Jul 2019 22:35:17 +0000 (15:35 -0700)
commit6c8fd21e7e33e7ebb83174a663e8bf3f42c91fad
tree0ef74aa77ece3c192dfef9cf8a251e12ddf8a63d
parente0336952d89f98d1c95c42e6ffa764bcd817e591
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