OpenCloudOS-Kernel/drivers/infiniband/ulp/ipoib
Alex Estrin 08bc327629 IB/ipoib: fix for rare multicast join race condition
A narrow window for race condition still exist between
multicast join thread and *dev_flush workers.
A kernel crash caused by prolong erratic link state changes
was observed (most likely a faulty cabling):

[167275.656270] BUG: unable to handle kernel NULL pointer dereference at
0000000000000020
[167275.665973] IP: [<ffffffffa05f8f2e>] ipoib_mcast_join+0xae/0x1d0 [ib_ipoib]
[167275.674443] PGD 0
[167275.677373] Oops: 0000 [#1] SMP
...
[167275.977530] Call Trace:
[167275.982225]  [<ffffffffa05f92f0>] ? ipoib_mcast_free+0x200/0x200 [ib_ipoib]
[167275.992024]  [<ffffffffa05fa1b7>] ipoib_mcast_join_task+0x2a7/0x490
[ib_ipoib]
[167276.002149]  [<ffffffff8109d5fb>] process_one_work+0x17b/0x470
[167276.010754]  [<ffffffff8109e3cb>] worker_thread+0x11b/0x400
[167276.019088]  [<ffffffff8109e2b0>] ? rescuer_thread+0x400/0x400
[167276.027737]  [<ffffffff810a5aef>] kthread+0xcf/0xe0
Here was a hit spot:
ipoib_mcast_join() {
..............
      rec.qkey      = priv->broadcast->mcmember.qkey;
                                       ^^^^^^^
.....
 }
Proposed patch should prevent multicast join task to continue
if link state change is detected.

Signed-off-by: Alex Estrin <alex.estrin@intel.com>

Changes from v4:
- as suggested by Doug Ledford, optimized spinlock usage,
i.e. ipoib_mcast_join() is called with lock held.
Changes from v3:
- sync with priv->lock before flag check.
Chages from v2:
- Move check for OPER_UP flag state to mcast_join() to
ensure no event worker is in progress.
- minor style fixes.
Changes from v1:
- No need to lock again if error detected.
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-02-12 14:53:22 -05: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
ipoib.h IB/IPoIB: Fix kernel panic on multicast flow 2016-01-19 12:59:54 -05:00
ipoib_cm.c Merge branches '4.5/Or-cleanup' and '4.5/rdma-cq' into k.o/for-4.5 2015-12-22 17:03:15 -05:00
ipoib_ethtool.c IB/ulps: Avoid calling ib_query_device 2015-12-22 14:39:00 -05: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: Do not set skb truesize since using one linearskb 2016-02-04 07:08:12 -05:00
ipoib_main.c IB/IPoIB: Fix kernel panic on multicast flow 2016-01-19 12:59:54 -05:00
ipoib_multicast.c IB/ipoib: fix for rare multicast join race condition 2016-02-12 14:53:22 -05: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: split struct ib_send_wr 2015-10-08 11:09:10 +01:00
ipoib_vlan.c IB/ipoib: Fix ndo_get_iflink 2015-04-17 15:21:04 -04:00