diff mbox

qedr: Unlock on error in qedr_post_send()

Message ID 20161115095059.GB15424@mwanda (mailing list archive)
State Not Applicable
Headers show

Commit Message

Dan Carpenter Nov. 15, 2016, 9:51 a.m. UTC
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 <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Amrani, Ram Nov. 15, 2016, 10:28 a.m. UTC | #1
> 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 <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c
> b/drivers/infiniband/hw/qedr/verbs.c
> index a615142..01d05b0 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -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;

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

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index a615142..01d05b0 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -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;