From 4f110760fda7fdff576e42124f6c3e3b7a0a99e5 Mon Sep 17 00:00:00 2001 From: Weihang Li Date: Wed, 21 Aug 2019 08:56:26 +0800 Subject: [PATCH] RDMA/hns: Modify QP to reset before destroy it in UD mode driver inclusion category: bugfix bugzilla: NA CVE: NA If we destroy QP without modifing QP to reset through mailbox at first in UD mode, hardware can still access to their resources after they are freed, which will cause ras and smmu errors sometimes. Feature or Bugfix: Bugfix Signed-off-by: Weihang Li Reviewed-by: chenglang Reviewed-by: wangxi Reviewed-by: liuyixian Reviewed-by: Yang Yingliang Signed-off-by: Yang Yingliang --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 14adac45197a..679997ba2fce 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -5215,7 +5215,9 @@ static int hns_roce_v2_destroy_qp_common(struct hns_roce_dev *hr_dev, unsigned long flags; int ret = 0; - if (hr_qp->ibqp.qp_type == IB_QPT_RC && hr_qp->state != IB_QPS_RESET) { + if ((hr_qp->ibqp.qp_type == IB_QPT_RC || + hr_qp->ibqp.qp_type == IB_QPT_UD) && + hr_qp->state != IB_QPS_RESET) { /* Modify qp to reset before destroying qp */ ret = hns_roce_v2_modify_qp(&hr_qp->ibqp, NULL, 0, hr_qp->state, IB_QPS_RESET); -- GitLab