linux_dsm_epyc7002/drivers/infiniband/hw
Yangyang Li 98a6151907 RDMA/hns: Fix a calltrace when registering MR from userspace
ibmr.device is assigned after MR is successfully registered, but both
write_mtpt() and frmr_write_mtpt() accesses it during the mr registration
process, which may cause the following error when trying to register MR in
userspace and pbl_hop_num is set to 0.

  pc : hns_roce_mtr_find+0xa0/0x200 [hns_roce]
  lr : set_mtpt_pbl+0x54/0x118 [hns_roce_hw_v2]
  sp : ffff00023e73ba20
  x29: ffff00023e73ba20 x28: ffff00023e73bad8
  x27: 0000000000000000 x26: 0000000000000000
  x25: 0000000000000002 x24: 0000000000000000
  x23: ffff00023e73bad0 x22: 0000000000000000
  x21: ffff0000094d9000 x20: 0000000000000000
  x19: ffff8020a6bdb2c0 x18: 0000000000000000
  x17: 0000000000000000 x16: 0000000000000000
  x15: 0000000000000000 x14: 0000000000000000
  x13: 0140000000000000 x12: 0040000000000041
  x11: ffff000240000000 x10: 0000000000001000
  x9 : 0000000000000000 x8 : ffff802fb7558480
  x7 : ffff802fb7558480 x6 : 000000000003483d
  x5 : ffff00023e73bad0 x4 : 0000000000000002
  x3 : ffff00023e73bad8 x2 : 0000000000000000
  x1 : 0000000000000000 x0 : ffff0000094d9708
  Call trace:
   hns_roce_mtr_find+0xa0/0x200 [hns_roce]
   set_mtpt_pbl+0x54/0x118 [hns_roce_hw_v2]
   hns_roce_v2_write_mtpt+0x14c/0x168 [hns_roce_hw_v2]
   hns_roce_mr_enable+0x6c/0x148 [hns_roce]
   hns_roce_reg_user_mr+0xd8/0x130 [hns_roce]
   ib_uverbs_reg_mr+0x14c/0x2e0 [ib_uverbs]
   ib_uverbs_write+0x27c/0x3e8 [ib_uverbs]
   __vfs_write+0x60/0x190
   vfs_write+0xac/0x1c0
   ksys_write+0x6c/0xd8
   __arm64_sys_write+0x24/0x30
   el0_svc_common+0x78/0x130
   el0_svc_handler+0x38/0x78
   el0_svc+0x8/0xc

Solve above issue by adding a pointer of structure hns_roce_dev as a
parameter of write_mtpt() and frmr_write_mtpt(), so that both of these
functions can access it before finishing MR's registration.

Fixes: 9b2cf76c9f ("RDMA/hns: Optimize PBL buffer allocation process")
Link: https://lore.kernel.org/r/1592314629-51715-1-git-send-email-liweihang@huawei.com
Signed-off-by: Yangyang Li <liyangyang20@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
2020-06-18 10:47:04 -03:00
..
bnxt_re treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
cxgb4 treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
efa RDMA/efa: Set maximum pkeys device attribute 2020-06-18 09:41:07 -03:00
hfi1 RDMA/hfi1: Fix trivial mis-spelling of 'descriptor' 2020-06-15 15:56:54 -03:00
hns RDMA/hns: Fix a calltrace when registering MR from userspace 2020-06-18 10:47:04 -03:00
i40iw treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mlx4 treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
mlx5 RDMA/mlx5: Add missed RST2INIT and INIT2INIT steps during ECE handshake 2020-06-18 09:52:29 -03:00
mthca treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
ocrdma treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
qedr RDMA/qedr: Fix KASAN: use-after-free in ucma_event_handler+0x532 2020-06-18 09:44:45 -03:00
qib treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
usnic treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
vmw_pvrdma treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile RDMA/iw_cxgb3: Remove the iw_cxgb3 module from kernel 2019-10-04 15:08:59 -03:00