]> git.itanic.dy.fi Git - linux-stable/commit
net/vmw_vsock: improve locking in vsock_connect_timeout()
authorNorbert Slusarek <nslusarek@gmx.net>
Fri, 5 Feb 2021 12:14:05 +0000 (13:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Feb 2021 09:35:19 +0000 (10:35 +0100)
commita5f0b6f7b1c0ae835c1bd2fe487adf620b6f73e9
tree9879c6ef0b8c51083c6bc1073a5b182582d5c9d7
parent611d93fbea54ad1d85163ca258b764b70ae0cd89
net/vmw_vsock: improve locking in vsock_connect_timeout()

commit 3d0bc44d39bca615b72637e340317b7899b7f911 upstream.

A possible locking issue in vsock_connect_timeout() was recognized by
Eric Dumazet which might cause a null pointer dereference in
vsock_transport_cancel_pkt(). This patch assures that
vsock_transport_cancel_pkt() will be called within the lock, so a race
condition won't occur which could result in vsk->transport to be set to NULL.

Fixes: 380feae0def7 ("vsock: cancel packets when failing to connect")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/trinity-f8e0937a-cf0e-4d80-a76e-d9a958ba3ef1-1612535522360@3c-app-gmx-bap12
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/vmw_vsock/af_vsock.c