linux-stable/net/vmw_vsock
Seth Forshee e3b3939fd1 vsock: remove vsock from connected table when connect is interrupted by a signal
commit b9208492fc upstream.

vsock_connect() expects that the socket could already be in the
TCP_ESTABLISHED state when the connecting task wakes up with a signal
pending. If this happens the socket will be in the connected table, and
it is not removed when the socket state is reset. In this situation it's
common for the process to retry connect(), and if the connection is
successful the socket will be added to the connected table a second
time, corrupting the list.

Prevent this by calling vsock_remove_connected() if a signal is received
while waiting for a connection. This is harmless if the socket is not in
the connected table, and if it is in the table then removing it will
prevent list corruption from a double add.

Note for backporting: this patch requires d5afa82c97 ("vsock: correct
removal of socket from the list"), which is in all current stable trees
except 4.9.y.

Fixes: d021c34405 ("VSOCK: Introduce VM Sockets")
Signed-off-by: Seth Forshee <sforshee@digitalocean.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/20220217141312.2297547-1-sforshee@digitalocean.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-02-23 11:57:34 +01:00
..
af_vsock.c vsock: remove vsock from connected table when connect is interrupted by a signal 2022-02-23 11:57:34 +01:00
af_vsock_tap.c VSOCK: Add vsockmon tap functions 2017-04-24 12:35:56 -04:00
hyperv_transport.c vsock: fix locking in vsock_shutdown() 2021-02-23 14:00:33 +01:00
Kconfig hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK) 2017-08-28 15:38:18 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
virtio_transport.c vsock/virtio: avoid potential deadlock when vsock device remove 2021-08-26 08:37:02 -04:00
virtio_transport_common.c vsock/virtio: update credit only if socket is not closed 2021-02-23 14:00:32 +01:00
vmci_transport.c vsock/vmci: log once the failed queue pair allocation 2021-05-22 10:57:34 +02:00
vmci_transport.h VSOCK: constify vmci_transport_notify_ops structures 2015-11-23 15:49:29 -05:00
vmci_transport_notify.c VSOCK: use TCP state constants for sk_state 2019-08-04 09:31:59 +02:00
vmci_transport_notify.h VSOCK: constify vmci_transport_notify_ops structures 2015-11-23 15:49:29 -05:00
vmci_transport_notify_qstate.c VSOCK: use TCP state constants for sk_state 2019-08-04 09:31:59 +02:00
vsock_addr.c