linux/drivers/infiniband/ulp/ipoib
Doug Ledford e5d1dcf1b0 IPoIB: fix mcast_dev_flush/mcast_restart_task race
Our mcast_dev_flush routine and our mcast_restart_task can race
against each other.  In particular, they both hold the priv->lock
while manipulating the rbtree and while removing mcast entries from
the multicast_list and while adding entries to the remove_list, but
they also both drop their locks prior to doing the actual removes.
The mcast_dev_flush routine is run entirely under the rtnl lock and so
has at least some locking.  The actual race condition is like this:

Thread 1                                Thread 2
ifconfig ib0 up
  start multicast join for broadcast
  multicast join completes for broadcast
  start to add more multicast joins
    call mcast_restart_task to add new entries
                                        ifconfig ib0 down
					  mcast_dev_flush
					    mcast_leave(mcast A)
    mcast_leave(mcast A)

As mcast_leave calls ib_sa_multicast_leave, and as member in
core/multicast.c is ref counted, we run into an unbalanced refcount
issue.  To avoid stomping on each others removes, take the rtnl lock
specifically when we are deleting the entries from the remove list.

Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
2014-12-15 18:11:14 -08:00
..
ipoib_cm.c IB: Add a QP creation flag to use GFP_NOIO allocations 2014-06-02 14:58:11 -07:00
ipoib_ethtool.c net: get rid of SET_ETHTOOL_OPS 2014-05-13 17:43:20 -04:00
ipoib_fs.c IPoIB: Remove unnecessary test for NULL before debugfs_remove() 2014-08-12 21:59:54 -07:00
ipoib_ib.c IB/ipoib: Avoid multicast join attempts with invalid P_key 2014-08-10 19:53:56 -07:00
ipoib_main.c net: better IFF_XMIT_DST_RELEASE support 2014-10-07 13:22:11 -04:00
ipoib_multicast.c IPoIB: fix mcast_dev_flush/mcast_restart_task race 2014-12-15 18:11:14 -08:00
ipoib_netlink.c infiniband: make sure the src net is infiniband when create new link 2014-01-03 20:38:56 -05:00
ipoib_verbs.c IB/core: Add flow steering support for IPoIB UD traffic 2014-01-14 14:06:50 -08:00
ipoib_vlan.c IPoIB: Fix deadlock between dev_change_flags() and __ipoib_dev_flush() 2013-11-08 14:42:49 -08:00
ipoib.h IPoIB: fix MCAST_FLAG_BUSY usage 2014-12-15 18:11:14 -08:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile IB/ipoib: Add rtnl_link_ops support 2012-09-20 16:49:17 -04:00