qedr: Unlock on error in qedr_post_send()
Subsystems (3)
PATCH 1/1 qedr: Unlock on error in qedr_post_send()
If "wr" is NULL then we return without unlocking. I added an unlock label and changed the direct returns to gotos.
Fixes afa0e13be754 ("qedr: Add support for data path")
Signed-off-by Dan Carpenter <[email protected]>
drivers/infiniband/hw/qedr/verbs.c +5 -3
@@ -2973,17 +2973,18 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,if ((qp->state =QED_ROCE_QP_STATE_RESET ) || (qp->state =QED_ROCE_QP_STATE_ERR )) { -spin_unlock_irqrestore (&qp->q_lock, flags); *bad_wr = wr;DP_DEBUG (dev,QEDR_MSG_CQ ,"QP in wrong state! QP icid=0x%x state %d\n" , qp->icid, qp->state); -return -EINVAL ; + rc = -EINVAL ; + goto unlock; }if (!wr) {DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto unlock; }while (wr) {
@@ -3012,6 +3013,7 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,/* Make sure write sticks */ mmiowb (); +unlock:spin_unlock_irqrestore (&qp->q_lock, flags);return rc;
Quoted 42 lines
If "wr" is NULL then we return without unlocking. I added an unlock label and changed the direct returns to gotos.
Fixes afa0e13be754 ("qedr: Add support for data path")Signed-off-by Dan Carpenter <[email protected]>drivers/infiniband/hw/qedr/verbs.c +4
-3@@ -2973,17 +2973,18 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, if ((qp->state == QED_ROCE_QP_STATE_RESET) || (qp->state == QED_ROCE_QP_STATE_ERR)) { -spin_unlock_irqrestore (&qp->q_lock, flags); *bad_wr = wr;DP_DEBUG (dev,QEDR_MSG_CQ ,"QP in wrong state! QP icid=0x%x state %d\n" , qp->icid, qp->state); -return -EINVAL ; + rc = -EINVAL ; + goto unlock; }if (!wr) {DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto unlock; }drivers/infiniband/hw/qedr/verbs.c +1
-0while (wr) {@@ -3012,6 +3013,7 @@ int qedr_post_send(struct ib_qp *ibqp, structib_send_wr *wr,/* Make sure write sticks */ mmiowb (); +unlock:spin_unlock_irqrestore (&qp->q_lock, flags);
Quoted 1 line
return rc;
Thanks for catching this. However this was already taken care of by Wei Yongjun in a different manner.
See: https://patchwork.kernel.org/patch/9409053/
Thanks,
Ram