• Jason Gunthorpe's avatar
    IB/ipoib: Do not remove child devices from within the ndo_uninit · 25405d98
    Jason Gunthorpe authored
    Switching to priv_destructor and needs_free_netdev created a subtle
    ordering problem in ipoib_remove_one.
    
    Now that unregister_netdev frees the netdev and priv we must ensure that
    the children are unregistered before trying to unregister the parent,
    or child unregister will use after free.
    
    The solution is to unregister the children, then parent, in the same batch
    all while holding the rtnl_lock. This closes all the races where a new
    child could have been added and ensures proper ordering.
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
    25405d98
ipoib_main.c 63 KB