qedr: Fix missing unlock on error in qedr_post_send()
Subsystems (2)
PATCH 1/1 qedr: Fix missing unlock on error in qedr_post_send()
From: Wei Yongjun <[email protected]>
Add the missing unlock before return from function qedr_post_send() in the error handling case.
--- drivers/infiniband/hw/qedr/verbs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/qedr/verbs.c +3 -1
@@ -2983,7 +2983,8 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,if (!wr) {DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto out_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 (); +out_unlock:spin_unlock_irqrestore (&qp->q_lock, flags);return rc;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 15 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
Add the missing unlock before return from function
qedr_post_send()in the error handling case.Signed-off-by Wei Yongjun <[email protected]>--- drivers/infiniband/hw/qedr/verbs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/infiniband/hw/qedr/verbs.c +0
-0
drivers/infiniband/hw/qedr/verbs.c int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · line 2988
Quoted 7 lines
drivers/infiniband/hw/qedr/verbs.c +2
-1@@ -2983,7 +2983,8 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,if (!wr) {DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto out_unlock; }
IMHO, this if needs to be moved to be before acquiring spinlock and avoid introducing new labels for this one case only.
Quoted 17 lines
drivers/infiniband/hw/qedr/verbs.c +1
-1while (wr) {@@ -3012,6 +3013,7 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,/* Make sure write sticks */ mmiowb (); +out_unlock:spin_unlock_irqrestore (&qp->q_lock, flags);return rc; --To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines
Quoted 6 lines
index a615142..e7c7417 100644
drivers/infiniband/hw/qedr/verbs.c +0
-0@@ -2983,7 +2983,8 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
Quoted 10 lines
drivers/infiniband/hw/qedr/verbs.c int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · line 2988
Quoted 6 lines
drivers/infiniband/hw/qedr/verbs.c +2
-1if (!wr) {DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto out_unlock; }IMHO, this if needs to be moved to be before acquiring spinlock and avoid introducing new labels for this one case only.
Thanks Wei and Leon.
Actually, perhaps we can totally remove the check itself -
Since this is kernel space, is it safe to presume that all ULPs are trusted to be well coded? (if not, and as a side note, I see that in MLX4 there's a for(..;wr;..) loop, but that wr is dereferenced earlier so perhaps this is a potential bug)
Ram
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 1/1 qedr: remove pointless NULL check in qedr_post_send()
In reply to a message not in the archiveFrom: Wei Yongjun <[email protected]>
Remove pointless NULL check for 'wr' in qedr_post_send().
---
v1 -> v2: remove pointless NULL check as Ram's suggestion
--- drivers/infiniband/hw/qedr/verbs.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/infiniband/hw/qedr/verbs.c +0 -5
@@ -2981,11 +2981,6 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,return -EINVAL ; } -if (!wr) { -DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; - } -while (wr) { rc =__qedr_post_send (ibqp, wr, bad_wr);if (rc)
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 17 lines · Ram
Quoted 6 lines
Quoted 6 lines
index a615142..e7c7417 100644
drivers/infiniband/hw/qedr/verbs.c +0
-0@@ -2983,7 +2983,8 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,Quoted 10 lines
drivers/infiniband/hw/qedr/verbs.c int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, · line 2988
Quoted 6 lines
drivers/infiniband/hw/qedr/verbs.c +2
-1if (!wr) {DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; + rc = -EINVAL ; + goto out_unlock; }IMHO, this if needs to be moved to be before acquiring spinlock and avoid introducing new labels for this one case only.
Quoted 4 lines
Thanks Wei and Leon.
Actually, perhaps we can totally remove the check itself -
Since this is kernel space, is it safe to presume that all ULPs are trusted to be well coded?
I think so.
Amrani, Ram
Acked-byRE: [PATCH v2] qedr: remove pointless NULL check in qedr_post_send()
In reply to a message not in the archiveQuoted 17 lines
drivers/infiniband/hw/qedr/verbs.c +0
-5@@ -2981,11 +2981,6 @@ int qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr, return -EINVAL ; } -if (!wr) { -DP_ERR (dev,"Got an empty post send.\n" ); -return -EINVAL ; - } -while (wr) { rc =__qedr_post_send (ibqp, wr, bad_wr);
Quoted 1 line
if (rc)
Thanks Wei.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Doug Ledford
AppliedRe: [PATCH v2] qedr: remove pointless NULL check in qedr_post_send()
In reply to a message not in the archiveQuoted 5 lines · Wei Yongjun
From: Wei Yongjun <[email protected]>
Remove pointless NULL check for 'wr' in
qedr_post_send().Signed-off-by Wei Yongjun <[email protected]>
Thanks, applied.
Signature · 2 lines
Doug Ledford <[email protected]> GPG Key ID: 0E572FDD