OSDN Git Service

IB/ipoib: replace local_irq_disable() with proper locking
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 16 May 2018 19:47:32 +0000 (21:47 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 17 May 2018 03:42:06 +0000 (21:42 -0600)
commit112f5c8199dd02dbee2aa9f21e087e777fb7f15e
treea1418d3701c2b203cad3dc0a74c2b42572b39ac4
parente818e255a58d64e86c8c93e3aa52498b1a3d1760
IB/ipoib: replace local_irq_disable() with proper locking

In ipoib_mcast_restart_task() the netif_addr_lock() is invoked prior
local_irq_save(). netif_addr_lock() should not be invoked in interrupt disabled
section, only in BH disabled sections.
The priv->lock is always acquired with disabled interrupts. The only place
where netif_addr_lock() and priv->lock nest ist ipoib_mcast_restart_task().

Drop the local_irq_save() and acquire priv->lock with spin_lock_irq() inside
the netif_addr locked section. It's safe to do so because the caller is either
a worker function or __ipoib_ib_dev_flush() which are both calling with
interrupts enabled (and since BH is enabled here, too so
netif_addr_lock_bh() needs to be used).

Cc: Doug Ledford <dledford@redhat.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/ulp/ipoib/ipoib_multicast.c