]> git.baikalelectronics.ru Git - kernel.git/commit
IB/mad: Fix lock-lock-timer deadlock in RMPP code
authorRoland Dreier <rdreier@cisco.com>
Wed, 23 Sep 2009 18:10:15 +0000 (11:10 -0700)
committerRoland Dreier <rolandd@cisco.com>
Wed, 23 Sep 2009 18:10:15 +0000 (11:10 -0700)
commit9b0c1feef51e1073d416b91badf9f654c67970df
tree49b2f52ee849e7888473eb228f1abe3c27ed9434
parent47f5141d4c428db147fb6af4c79eba742806252c
IB/mad: Fix lock-lock-timer deadlock in RMPP code

Holding agent->lock across cancel_delayed_work() (which does
del_timer_sync()) in ib_cancel_rmpp_recvs() leads to lockdep reports of
possible lock-timer deadlocks if a consumer ever does something that
connects agent->lock to a lock taken in IRQ context (cf
http://marc.info/?l=linux-rdma&m=125243699026045).

Fix this by changing the list items to a new state "CANCELING" while
holding the lock, and then canceling the delayed work without holding
the lock.  If the delayed work runs after the lock is dropped, it will
see the state is CANCELING and return immediately, so the list will
stay stable while we traverse it with the lock not held.

Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/core/mad_rmpp.c