]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - net/vmw_vsock/af_vsock.c
VSOCK: bind to random port for VMADDR_PORT_ANY
authorLepton Wu <ytht.net@gmail.com>
Tue, 11 Dec 2018 19:12:55 +0000 (11:12 -0800)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:28 +0000 (14:21 -0300)
commit2d69a837ae0762c61db8797adcd4f8b432f4cbc1
tree680370479b7020c631c672b707651e0ed8696d1c
parentbb4c5f0a48f1fbd4302d0d96f175f30b1b487a9b
VSOCK: bind to random port for VMADDR_PORT_ANY

BugLink: https://bugs.launchpad.net/bugs/1855787
[ Upstream commit 8236b08cf50f85bbfaf48910a0b3ee68318b7c4b ]

The old code always starts from fixed port for VMADDR_PORT_ANY. Sometimes
when VMM crashed, there is still orphaned vsock which is waiting for
close timer, then it could cause connection time out for new started VM
if they are trying to connect to same port with same guest cid since the
new packets could hit that orphaned vsock. We could also fix this by doing
more in vhost_vsock_reset_orphans, but any way, it should be better to start
from a random local port instead of a fixed one.

Signed-off-by: Lepton Wu <ytht.net@gmail.com>
Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
net/vmw_vsock/af_vsock.c