
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBSE4C ---------------------------------------------------------------------- hns_roce_unregister_udca() is not called when hns_roce_alloc_reset_entry() failed. Reorder the sequence of error path in hns_roce_alloc_ucontext() to fix it. Besides, to keep the coding constant, reorder hns_roce_dealloc_ucontext() accordingly as well. Fixes: 754c3a8adaa5 ("RDMA/hns: Use one CQ bank per context") Fixes: e8b1fec497a0 ("RDMA/hns: Kernel notify usr space to stop ring db") Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com> --- drivers/infiniband/hw/hns/hns_roce_main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index 61586142426c..720e463ccea4 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -633,10 +633,10 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx, return 0; error_fail_copy_to_udata: - hns_roce_unregister_udca(hr_dev, context); hns_roce_dealloc_reset_entry(context); error_fail_reset_entry: + hns_roce_unregister_udca(hr_dev, context); if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_CQ_RECORD_DB || hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB) mutex_destroy(&context->page_mutex); @@ -656,20 +656,20 @@ static void hns_roce_dealloc_ucontext(struct ib_ucontext *ibcontext) struct hns_roce_ucontext *context = to_hr_ucontext(ibcontext); struct hns_roce_dev *hr_dev = to_hr_dev(ibcontext->device); + hns_roce_put_cq_bankid_for_uctx(context); + hns_roce_unregister_uctx_debugfs(context); + mutex_lock(&hr_dev->uctx_list_mutex); list_del(&context->list); mutex_unlock(&hr_dev->uctx_list_mutex); - hns_roce_unregister_uctx_debugfs(context); - + hns_roce_dealloc_reset_entry(context); hns_roce_unregister_udca(hr_dev, context); if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_CQ_RECORD_DB || hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_RECORD_DB) mutex_destroy(&context->page_mutex); - hns_roce_put_cq_bankid_for_uctx(context); hns_roce_dealloc_uar_entry(context); - hns_roce_dealloc_reset_entry(context); ida_free(&hr_dev->uar_ida.ida, (int)context->uar.logic_idx); } -- 2.33.0