linux-stable/drivers/infiniband/hw/hns
Yixing Liu 12bcaf87d8 RDMA/hns: Fix NULL pointer problem in free_mr_init()
Lock grab occurs in a concurrent scenario, resulting in stepping on a NULL
pointer.  It should be init mutex_init() first before use the lock.

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000
  Call trace:
   __mutex_lock.constprop.0+0xd0/0x5c0
   __mutex_lock_slowpath+0x1c/0x2c
   mutex_lock+0x44/0x50
   free_mr_send_cmd_to_hw+0x7c/0x1c0 [hns_roce_hw_v2]
   hns_roce_v2_dereg_mr+0x30/0x40 [hns_roce_hw_v2]
   hns_roce_dereg_mr+0x4c/0x130 [hns_roce_hw_v2]
   ib_dereg_mr_user+0x54/0x124
   uverbs_free_mr+0x24/0x30
   destroy_hw_idr_uobject+0x38/0x74
   uverbs_destroy_uobject+0x48/0x1c4
   uobj_destroy+0x74/0xcc
   ib_uverbs_cmd_verbs+0x368/0xbb0
   ib_uverbs_ioctl+0xec/0x1a4
   __arm64_sys_ioctl+0xb4/0x100
   invoke_syscall+0x50/0x120
   el0_svc_common.constprop.0+0x58/0x190
   do_el0_svc+0x30/0x90
   el0_svc+0x2c/0xb4
   el0t_64_sync_handler+0x1a4/0x1b0
   el0t_64_sync+0x19c/0x1a0

Fixes: 70f9252158 ("RDMA/hns: Use the reserved loopback QPs to free MR before destroying MPT")
Signed-off-by: Yixing Liu <liuyixing1@huawei.com>
Signed-off-by: Haoyue Xu <xuhaoyue1@hisilicon.com>
Link: https://lore.kernel.org/r/20221024083814.1089722-3-xuhaoyue1@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2022-10-24 15:01:57 +03:00
..
hns_roce_ah.c treewide: use prandom_u32_max() when possible, part 1 2022-10-11 17:42:55 -06:00
hns_roce_alloc.c RDMA/hns: Remove support for HIP06 2022-01-05 15:50:56 -04:00
hns_roce_cmd.c RDMA/hns: Remove similar code that configures the hardware contexts 2022-03-04 17:36:31 -04:00
hns_roce_cmd.h RDMA/hns: Remove similar code that configures the hardware contexts 2022-03-04 17:36:31 -04:00
hns_roce_common.h RDMA/hns: Remove support for HIP06 2022-01-05 15:50:56 -04:00
hns_roce_cq.c RDMA/hns: Unified Log Printing Style 2022-09-27 10:15:25 -03:00
hns_roce_db.c RDMA/hns: Remove support for HIP06 2022-01-05 15:50:56 -04:00
hns_roce_device.h Linux 6.0 2022-10-06 19:48:45 -03:00
hns_roce_hem.c RDMA/hns: Unified Log Printing Style 2022-09-27 10:15:25 -03:00
hns_roce_hem.h RDMA/hns: Remove redundant 'phy_addr' in hns_roce_hem_list_find_mtt() 2022-09-27 10:15:25 -03:00
hns_roce_hw_v2.c RDMA/hns: Fix NULL pointer problem in free_mr_init() 2022-10-24 15:01:57 +03:00
hns_roce_hw_v2.h RDMA/hns: Disable local invalidate operation 2022-10-24 15:01:57 +03:00
hns_roce_main.c Linux 6.0 2022-10-06 19:48:45 -03:00
hns_roce_mr.c RDMA/hns: Unified Log Printing Style 2022-09-27 10:15:25 -03:00
hns_roce_pd.c RDMA/hns: Remove support for HIP06 2022-01-05 15:50:56 -04:00
hns_roce_qp.c Linux 6.0 2022-10-06 19:48:45 -03:00
hns_roce_restrack.c RDMA/hns: Support MR's restrack raw ops for hns driver 2022-08-24 08:47:18 +03:00
hns_roce_srq.c RDMA/hns: Refactor the alloc_srqc() 2022-03-04 17:36:32 -04:00
Kconfig RDMA/hns: Remove support for HIP06 2022-01-05 15:50:56 -04:00
Makefile RDMA/hns: Remove redundant DFX file and DFX ops structure 2022-08-23 11:34:42 +03:00