diff options
author | Norbert Slusarek <nslusarek@gmx.net> | 2021-02-05 13:12:06 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-02-17 11:02:29 +0100 |
commit | fcee53dc03c5aa5bca6631fa0aa900efc3079236 (patch) | |
tree | 05ee6aedafdc7d785ab298b8a71b0eebfc9ddb42 | |
parent | c9013813413e12c8968e22964e314841b93af3c5 (diff) | |
download | linux-stable-fcee53dc03c5aa5bca6631fa0aa900efc3079236.tar.gz linux-stable-fcee53dc03c5aa5bca6631fa0aa900efc3079236.tar.bz2 linux-stable-fcee53dc03c5aa5bca6631fa0aa900efc3079236.zip |
net/vmw_vsock: fix NULL pointer dereference
commit 5d1cbcc990f18edaddddef26677073c4e6fad7b7 upstream.
In vsock_stream_connect(), a thread will enter schedule_timeout().
While being scheduled out, another thread can enter vsock_stream_connect()
as well and set vsk->transport to NULL. In case a signal was sent, the
first thread can leave schedule_timeout() and vsock_transport_cancel_pkt()
will be called right after. Inside vsock_transport_cancel_pkt(), a null
dereference will happen on transport->cancel_pkt.
Fixes: c0cfa2d8a788 ("vsock: add multi-transports support")
Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://lore.kernel.org/r/trinity-c2d6cede-bfb1-44e2-85af-1fbc7f541715-1612535117028@3c-app-gmx-bap12
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/vmw_vsock/af_vsock.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index f64e681493a5..020d87886254 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -1216,7 +1216,7 @@ static int vsock_transport_cancel_pkt(struct vsock_sock *vsk) { const struct vsock_transport *transport = vsk->transport; - if (!transport->cancel_pkt) + if (!transport || !transport->cancel_pkt) return -EOPNOTSUPP; return transport->cancel_pkt(vsk); |