rdma/qedr: Fix crash due to redundant release of device's qp memory
Subsystems (2)
PATCH 1/1 rdma/qedr: Fix crash due to redundant release of device's qp memory
Device's QP memory should only be allocated and released by IB layer. This patch removes the redundant release of the device's qp memory and uses completion APIs to make sure that .destroy_qp() only return, when qp reference becomes 0.
Fixes 514aee660df4 ("RDMA: Globally allocate and release QP memory")
Acked-by Michal Kalderon <[email protected]>
Signed-off-by Ariel Elior <[email protected]>
Signed-off-by Shai Malin <[email protected]>
Signed-off-by Alok Prasad <[email protected]>
Signed-off-by Prabhakar Kushwaha <[email protected]>
--- drivers/infiniband/hw/qedr/qedr.h | 1 + drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 +- drivers/infiniband/hw/qedr/verbs.c | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/infiniband/hw/qedr/qedr.h +1 -0
@@ -455,6 +455,7 @@ struct qedr_qp {/* synchronization objects used with iwarp ep */ struct kref refcnt;struct completion iwarp_cm_comp; +struct completion qp_rel_comp;unsigned long iwarp_cm_flags;/* enum iwarp_cm_flags */ };
drivers/infiniband/hw/qedr/qedr_iw_cm.c +1 -1
@@ -83,7 +83,7 @@ static void qedr_iw_free_qp(struct kref *ref) { struct qedr_qp *qp = container_of(ref, struct qedr_qp, refcnt); -kfree (qp); +complete (&qp->qp_rel_comp); } static void
drivers/infiniband/hw/qedr/verbs.c +4 -1
@@ -1357,6 +1357,7 @@ static void qedr_set_common_qp_params(struct qedr_dev *dev,if (rdma_protocol_iwarp (&dev->ibdev,1 )) {kref_init (&qp->refcnt);init_completion (&qp->iwarp_cm_comp); +init_completion (&qp->qp_rel_comp); } qp->pd = pd;
@@ -2857,8 +2858,10 @@ int qedr_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)qedr_free_qp_resources (dev, qp, udata); -if (rdma_protocol_iwarp (&dev->ibdev,1 )) +if (rdma_protocol_iwarp (&dev->ibdev,1 )) {qedr_iw_qp_rem_ref (&qp->ibqp); +wait_for_completion (&qp->qp_rel_comp); + }return 0 ; }
Signature · 1 line
2.24.1
Quoted 11 lines · Prabhakar Kushwaha
Device's QP memory should only be allocated and released by IB layer. This patch removes the redundant release of the device's qp memory and uses completion APIs to make sure that .destroy_qp() only return, when qp reference becomes 0.
Fixes 514aee660df4 ("RDMA: Globally allocate and release QP memory")Acked-by Michal Kalderon <[email protected]>Signed-off-by Ariel Elior <[email protected]>Signed-off-by Shai Malin <[email protected]>Signed-off-by Alok Prasad <[email protected]>Signed-off-by Prabhakar Kushwaha <[email protected]>
Quoted 5 lines
--- drivers/infiniband/hw/qedr/qedr.h | 1 + drivers/infiniband/hw/qedr/qedr_iw_cm.c | 2 +- drivers/infiniband/hw/qedr/verbs.c | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-)
Applied to for-rc, thanks
Jason