Commit 4fe50186 authored by Budimir Markovic's avatar Budimir Markovic Committed by Lee Jones
Browse files

UPSTREAM: vsock: Do not allow binding to VMADDR_PORT_ANY



commit aba0c94f upstream.

It is possible for a vsock to autobind to VMADDR_PORT_ANY. This can
cause a use-after-free when a connection is made to the bound socket.
The socket returned by accept() also has port VMADDR_PORT_ANY but is not
on the list of unbound sockets. Binding it will result in an extra
refcount decrement similar to the one fixed in fcdd2242 (vsock: Keep
the binding until socket destruction).

Modify the check in __vsock_bind_connectible() to also prevent binding
to VMADDR_PORT_ANY.

Bug: 439253642
Fixes: d021c344 ("VSOCK: Introduce VM Sockets")
Reported-by: default avatarBudimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: default avatarBudimir Markovic <markovicbudimir@gmail.com>
Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Link: https://patch.msgid.link/20250807041811.678-1-markovicbudimir@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 32950b19)
Signed-off-by: default avatarLee Jones <joneslee@google.com>
Change-Id: I5726b83785f2b49b21d5f41aa247fccd6fda71b2
parent f9c3d286
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment