]> git.baikalelectronics.ru Git - kernel.git/commit
IB/ipoib: Do not remove child devices from within the ndo_uninit
authorJason Gunthorpe <jgg@mellanox.com>
Sun, 29 Jul 2018 08:34:58 +0000 (11:34 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 3 Aug 2018 02:27:43 +0000 (20:27 -0600)
commitcc3a53dbe98574cbfd251f553c28cb6561d0abb0
treec953e4b89a1d828969828d35aefa8cabac97fb7f
parent205a0be26af80d3b6f3c47a4d0f4cdcc3214dd5f
IB/ipoib: Do not remove child devices from within the ndo_uninit

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: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/ulp/ipoib/ipoib.h
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_vlan.c