]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
vsock: correct removal of socket from the list
authorSunil Muthuswamy <sunilmut@microsoft.com>
Thu, 13 Jun 2019 03:52:27 +0000 (03:52 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
commit08adbfa032e2e202953fc0054a641b33c45c54a9
tree520804659eaa4d9410bece0d391fd321c3729dcc
parent600ebf43010b2f81912e8930c3c2544c82f4425a
vsock: correct removal of socket from the list

BugLink: https://bugs.launchpad.net/bugs/1839213
commit d5afa82c977ea06f7119058fa0eb8519ea501031 upstream.

The current vsock code for removal of socket from the list is both
subject to race and inefficient. It takes the lock, checks whether
the socket is in the list, drops the lock and if the socket was on the
list, deletes it from the list. This is subject to race because as soon
as the lock is dropped once it is checked for presence, that condition
cannot be relied upon for any decision. It is also inefficient because
if the socket is present in the list, it takes the lock twice.

Signed-off-by: Sunil Muthuswamy <sunilmut@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
net/vmw_vsock/af_vsock.c