Skip to content

Commit

Permalink
RDMA/hns: Fix accessing invalid dip_ctx during destroying QP
Browse files Browse the repository at this point in the history
If it fails to modify QP to RTR, dip_ctx will not be attached. And
during detroying QP, the invalid dip_ctx pointer will be accessed.

Fixes: faa6244 ("RDMA/hns: Fix different dgids mapping to the same dip_idx")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20241220055249.146943-3-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
  • Loading branch information
Chengchang Tang authored and Leon Romanovsky committed Dec 23, 2024
1 parent 8673a6c commit 0572ecc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/infiniband/hw/hns/hns_roce_hw_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -5619,6 +5619,9 @@ static void put_dip_ctx_idx(struct hns_roce_dev *hr_dev,
{
struct hns_roce_dip *hr_dip = hr_qp->dip;

if (!hr_dip)
return;

xa_lock(&hr_dev->qp_table.dip_xa);

hr_dip->qp_cnt--;
Expand Down

0 comments on commit 0572ecc

Please sign in to comment.