]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:31:59 +0000 (09:31 +0200)
commit8cf9ddf9754c2a069ecac250b417f8bd328d1a11
tree269fcbf4447e9a8180b0a1721b0ac8ba78542bae
parent62c0c9d69b1f8f0efc0c292407fcc7a9d4d5c7b5
vsock: correct removal of socket from the list

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>
net/vmw_vsock/af_vsock.c