linux/drivers/infiniband/hw
Ira Weiny 3faa3d9a30 IB/hfi1: Make use of mm consistent
The hfi1 driver registers a mmu_notifier callback when /dev/hfi1_* is
opened, and unregisters it when the device is closed.  The driver
incorrectly assumes that the close will always happen from the same
context as the open.  In particular, closes due to SIGKILL or OOM killer
activity may happen from a different context.  In these cases, the wrong
mm is passed to mmu_notifier_unregister(), which causes improper reference
counting for the victim mm, and eventual memory corruption.

Preserve the mm for all open file descriptors and use this mm rather than
current->mm for memory operations for the lifetime of that fd.  Note: this
patch leaves 1 use of current->mm in place.  This use is removed in a
follow on patch because other functional changes were required prior to
that use being removed.

If registration fails, there is no reason to keep the handler object
around.  Free the handler object rather than add it to the list to
prevent any mmu_notifier operations, including unregister, when
registration fails.

Suggested-by: Jim Foraker <foraker1@llnl.gov>
Reviewed-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@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: Make use of mm consistent 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