IB/ipoib: Maintain the child_intfs list from ndo_init/uninit
authorJason Gunthorpe <jgg@mellanox.com>
Sun, 29 Jul 2018 08:34:59 +0000 (11:34 +0300)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 3 Aug 2018 02:27:44 +0000 (20:27 -0600)
commit13476d35bba60b59521ff25d902fdb552b8bf2ac
treea6064d13b53ae0cd8cc5ad8f7672244918fbfdff
parent25405d98a2aa0b9983bb9c36b0b00815d39394f4
IB/ipoib: Maintain the child_intfs list from ndo_init/uninit

This fixes a bug in the netlink path where the vlan_rwsem was not
held around __ipoib_vlan_add causing the child_intfs to be manipulated
unsafely.

In the process this greatly simplifies the vlan_rwsem write side locking
to only cover a single non-sleeping statement.

This also further increases the safety of the removal ordering by holding
the netdev of the parent while the child is active to ensure most bugs
become either an oops on a NULL priv or a deadlock on the netdev refcount.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
drivers/infiniband/ulp/ipoib/ipoib_main.c
drivers/infiniband/ulp/ipoib/ipoib_netlink.c
drivers/infiniband/ulp/ipoib/ipoib_vlan.c