]> git.baikalelectronics.ru Git - kernel.git/commit
geneve: Fix races between socket add and release.
authorJesse Gross <jesse@nicira.com>
Wed, 17 Dec 2014 02:25:32 +0000 (18:25 -0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 18 Dec 2014 17:38:13 +0000 (12:38 -0500)
commit220546362f0ab18a768dcf3f2eb7bc33dc015cdd
treed93c1ec4635a9d2d64fff54d376e40da3a72e13e
parentf64d561f8726f42db68f0ccbf768db82b6a88daa
geneve: Fix races between socket add and release.

Currently, searching for a socket to add a reference to is not
synchronized with deletion of sockets. This can result in use
after free if there is another operation that is removing a
socket at the same time. Solving this requires both holding the
appropriate lock and checking the refcount to ensure that it
has not already hit zero.

Inspired by a related (but not exactly the same) issue in the
VXLAN driver.

Fixes: f1a77c96 ("net: Add Geneve tunneling protocol driver")
CC: Andy Zhou <azhou@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Thomas Graf <tgraf@suug.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/geneve.c