]> git.baikalelectronics.ru Git - kernel.git/commit
vxlan: fix race caused by dropping rtnl_unlock
authorStephen Hemminger <stephen@networkplumber.org>
Mon, 17 Jun 2013 21:16:11 +0000 (14:16 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 24 Jun 2013 15:40:32 +0000 (08:40 -0700)
commite64d8f788e08b6be9c1e5b592fe9e3dc0fe15f24
treebcc3144d0fcc631d666be990c6bb95b69505b741
parentae833b5e2581bd8e5183ac94ec9df57fcf91f44f
vxlan: fix race caused by dropping rtnl_unlock

It is possible for two cpu's to race creating vxlan device.
For most cases this is harmless, but the ability to assign "next
avaliable vxlan device" relies on rtnl lock being held across the
whole operation. Therfore two instances of calling:
  ip li add vxlan%d vxlan ...
could collide and create two devices with same name.

To fix this defer creation of socket to a work queue, and
handle possible races there. Introduce a lock to ensure that
changes to vxlan socket hash list is SMP safe.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
drivers/net/vxlan.c