Commit 359ee527 authored by Jiyong Park's avatar Jiyong Park Committed by Greg Kroah-Hartman
Browse files

BACKPORT: vsock: each transport cycles only on its own sockets

This is an KMI-preserving implementation of commit
8e6ed963 upstream.

When iterating over sockets using vsock_for_each_connected_socket, make
sure that a transport filters out sockets that don't belong to the
transport.

There actually was an issue caused by this; in a nested VM
configuration, destroying the nested VM (which often involves the
closing of /dev/vhost-vsock if there was h2g connections to the nested
VM) kills not only the h2g connections, but also all existing g2h
connections to the (outmost) host which are totally unrelated.

Tested: Executed the following steps on Cuttlefish (Android running on a
VM) [1]: (1) Enter into an `adb shell` session - to have a g2h
connection inside the VM, (2) open and then close /dev/vhost-vsock by
`exec 3< /dev/vhost-vsock && exec 3<&-`, (3) observe that the adb
session is not reset.

[1] https://android.googlesource.com/device/google/cuttlefish/



Fixes: c0cfa2d8 ("vsock: add multi-transports support")
Signed-off-by: default avatarJiyong Park <jiyong@google.com>
(cherry picked from commit 8e6ed963)
Change-Id: I271ddbf365d336269a78f603543b82a52306c7c4
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 4a29d82a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment