]> git.baikalelectronics.ru Git - 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)
committerDavid S. Miller <davem@davemloft.net>
Sat, 15 Jun 2019 02:20:20 +0000 (19:20 -0700)
commitcc4a351361a11bb1e2ebe7913169087f7d26ac0d
tree1c8950af37bfb47eb9fd0774151d49d710ab8de7
parent33026cc8e5d941535ebd16c45776c784c5a372ee
vsock: correct removal of socket from the list

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