diff options
author | Chengchang Tang <tangchengchang@huawei.com> | 2024-12-20 13:52:47 +0800 |
---|---|---|
committer | Leon Romanovsky <leon@kernel.org> | 2024-12-23 09:58:30 -0500 |
commit | 0572eccf239ce4bd89bd531767ec5ab20e249290 (patch) | |
tree | 5693f6985e9dda4374030c37a1c9d68ddd022a67 | |
parent | 8673a6c2d9e483dfeeef83a1f06f59e05636f4d1 (diff) | |
download | lwn-0572eccf239ce4bd89bd531767ec5ab20e249290.tar.gz lwn-0572eccf239ce4bd89bd531767ec5ab20e249290.zip |
RDMA/hns: Fix accessing invalid dip_ctx during destroying QP
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: faa62440a577 ("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>
-rw-r--r-- | drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 697b17cca02e..6dddadb90e02 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -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--; |