1
0
Fork 0
alistair23-linux/net/vmw_vsock
Stefano Garzarella 1c5fae9c9a vsock: fix locking in vsock_shutdown()
In vsock_shutdown() we touched some socket fields without holding the
socket lock, such as 'state' and 'sk_flags'.

Also, after the introduction of multi-transport, we are accessing
'vsk->transport' in vsock_send_shutdown() without holding the lock
and this call can be made while the connection is in progress, so
the transport can change in the meantime.

To avoid issues, we hold the socket lock when we enter in
vsock_shutdown() and release it when we leave.

Among the transports that implement the 'shutdown' callback, only
hyperv_transport acquired the lock. Since the caller now holds it,
we no longer take it.

Fixes: d021c34405 ("VSOCK: Introduce VM Sockets")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-02-09 15:31:22 -08:00
..
Kconfig vsock: add vsock_loopback transport 2019-12-11 15:01:23 -08:00
Makefile vsock: add vsock_loopback transport 2019-12-11 15:01:23 -08:00
af_vsock.c vsock: fix locking in vsock_shutdown() 2021-02-09 15:31:22 -08:00
af_vsock_tap.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
diag.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 321 2019-06-05 17:37:05 +02:00
hyperv_transport.c vsock: fix locking in vsock_shutdown() 2021-02-09 15:31:22 -08:00
virtio_transport.c vsock/virtio: annotate 'the_virtio_vsock' RCU pointer 2020-07-15 17:47:15 -07:00
virtio_transport_common.c vsock/virtio: update credit only if socket is not closed 2021-02-08 13:27:46 -08:00
vmci_transport.c vsock/vmci: make vmci_vsock_transport_cb() static 2020-06-05 13:18:26 -07:00
vmci_transport.h vsock: handle buffer_size sockopts in the core 2019-11-14 18:12:18 -08:00
vmci_transport_notify.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 321 2019-06-05 17:37:05 +02:00
vmci_transport_notify.h vsock: remove include/linux/vm_sockets.h file 2019-11-14 18:12:17 -08:00
vmci_transport_notify_qstate.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 321 2019-06-05 17:37:05 +02:00
vsock_addr.c vsock_addr: Check for supported flag values 2020-12-14 19:33:39 -08:00
vsock_loopback.c vsock: add vsock_loopback transport 2019-12-11 15:01:23 -08:00