linux-stable/net/vmw_vsock
Alexander Popov 55d900415b vsock: fix the race conditions in multi-transport support
commit c518adafa3 upstream.

There are multiple similar bugs implicitly introduced by the
commit c0cfa2d8a7 ("vsock: add multi-transports support") and
commit 6a2c096210 ("vsock: prevent transport modules unloading").

The bug pattern:
 [1] vsock_sock.transport pointer is copied to a local variable,
 [2] lock_sock() is called,
 [3] the local variable is used.
VSOCK multi-transport support introduced the race condition:
vsock_sock.transport value may change between [1] and [2].

Let's copy vsock_sock.transport pointer to local variables after
the lock_sock() call.

Fixes: c0cfa2d8a7 ("vsock: add multi-transports support")
Signed-off-by: Alexander Popov <alex.popov@linux.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Link: https://lore.kernel.org/r/20210201084719.2257066-1-alex.popov@linux.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-03 23:28:52 +01:00
..
af_vsock.c vsock: fix the race conditions in multi-transport support 2021-02-03 23:28:52 +01:00
af_vsock_tap.c
diag.c
hyperv_transport.c
Kconfig
Makefile
virtio_transport.c
virtio_transport_common.c vsock/virtio: discard packets only when socket is really closed 2020-11-23 16:36:29 -08:00
vmci_transport.c
vmci_transport.h
vmci_transport_notify.c
vmci_transport_notify.h
vmci_transport_notify_qstate.c
vsock_addr.c
vsock_loopback.c