• Stephen Hemminger's avatar
    vxlan: fix race caused by dropping rtnl_unlock · 1c51a915
    Stephen Hemminger authored
    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: default avatarStephen Hemminger <stephen@networkplumber.org>
    1c51a915
vxlan.c 44.9 KB