1
0
Fork 0
alistair23-linux/drivers/infiniband/hw
Dean Luick b85ced9151 IB/hfi1: Consistently call ops->remove outside spinlock
The ops->remove() callback was called by hfi1_mmu_unregister() with a
NULL mm argument while holding a spinlock.  In the case of sdma_rb_remove()
this caused it to pass current->mm to hfi1_release_user_pages()

This had 2 problems.  First this would attempt to acquire the mmap_sem
under a spin lock.  Second the use of current->mm is not always guaranteed
to be the proper mm when the fd is being closed.

Rather than depend on this implicit behavior we move all calls to
ops->remove outside of the spinlock.  This also allows the correct
mm to be used in the remove callback without fear of deadlock.

Because the MMU notifier is not guaranteed to hold mm->mmap_sem, but
usually does, we must delay all remove callbacks until out of the notifier,
when the callbacks can take the mmap_sem if they need to.

Code comments were added to clarify what the expectations are for the
users of the mmu rb tree.

Suggested-by: Jim Foraker <foraker1@llnl.gov>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
2016-08-02 22:46:21 -04:00
..
cxgb3 Round two of 4.7 merge window patches 2016-05-28 11:04:16 -07:00
cxgb4 IB/core: Make device counter infrastructure dynamic 2016-05-26 12:52:51 -04:00
hfi1 IB/hfi1: Consistently call ops->remove outside spinlock 2016-08-02 22:46:21 -04:00
i40iw i40iw: Enable remote access rights for stag allocation 2016-07-12 10:46:34 -04:00
mlx4 Merge branches '4.7-rc-misc', 'hfi1-fixes', 'i40iw-rc-fixes' and 'mellanox-rc-fixes' into k.o/for-4.7-rc 2016-06-23 12:22:33 -04:00
mlx5 IB/mlx5: Fix wrong naming of port_rcv_data counter 2016-06-23 10:03:57 -04:00
mthca mm/gup: Switch all callers of get_user_pages() to not pass tsk/mm 2016-02-16 10:11:12 +01:00
nes Primary 4.7 merge window changes 2016-05-20 14:35:07 -07:00
ocrdma IB/core: Enhance ib_map_mr_sg() 2016-05-13 13:37:57 -04:00
qib IB/qib, IB/hfi1: Fix grh creation in ud loopback 2016-08-02 16:00:58 -04:00
usnic IB/usnic: Remove unused DMA attributes 2016-06-06 19:28:06 -04:00
Makefile IB/hfi1: Move driver out of staging 2016-05-26 11:35:14 -04:00