]> git.baikalelectronics.ru Git - kernel.git/commit
vsock/virtio: update credit only if socket is not closed
authorStefano Garzarella <sgarzare@redhat.com>
Mon, 8 Feb 2021 14:44:54 +0000 (15:44 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 8 Feb 2021 21:27:46 +0000 (13:27 -0800)
commit5e43bd75ea970bbac579f796fc8b9743ad039a3b
treec0b4ee4ca792efce5a8df27e236b3c9f4a4274dc
parent681c951ca90fc008dd79f4d5d7ce94305c30da8d
vsock/virtio: update credit only if socket is not closed

If the socket is closed or is being released, some resources used by
virtio_transport_space_update() such as 'vsk->trans' may be released.

To avoid a use after free bug we should only update the available credit
when we are sure the socket is still open and we have the lock held.

Fixes: b7fc5bc0aaaf ("VSOCK: Introduce virtio_vsock_common.ko")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/r/20210208144454.84438-1-sgarzare@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/vmw_vsock/virtio_transport_common.c