diff options
author | Stefano Garzarella <sgarzare@redhat.com> | 2019-07-05 13:04:52 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-07-08 15:35:17 -0700 |
commit | 0deab087b16abb755dca6da5d3685375f8ff8c85 (patch) | |
tree | f23b480f35390cf3b8aa59d79207a5c72a4afb80 /net/vmw_vsock/Makefile | |
parent | 1a2d405c0081e466cc56309652de3ce8467b3812 (diff) | |
download | linux-0deab087b16abb755dca6da5d3685375f8ff8c85.tar.gz |
vsock/virtio: use RCU to avoid use-after-free on the_virtio_vsock
Some callbacks used by the upper layers can run while we are in the
.remove(). A potential use-after-free can happen, because we free
the_virtio_vsock without knowing if the callbacks are over or not.
To solve this issue we move the assignment of the_virtio_vsock at the
end of .probe(), when we finished all the initialization, and at the
beginning of .remove(), before to release resources.
For the same reason, we do the same also for the vdev->priv.
We use RCU to be sure that all callbacks that use the_virtio_vsock
ended before freeing it. This is not required for callbacks that
use vdev->priv, because after the vdev->config->del_vqs() we are sure
that they are ended and will no longer be invoked.
We also take the mutex during the .remove() to avoid that .probe() can
run while we are resetting the device.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/vmw_vsock/Makefile')
0 files changed, 0 insertions, 0 deletions