aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Pearson <[email protected]>2023-05-15 15:10:57 -0500
committerJason Gunthorpe <[email protected]>2023-05-16 16:52:45 -0300
commit17eabd6a044b57b2c1b5459eb9d11af3ea909e63 (patch)
tree39775cb75fe486c1569d5d0a35fe42194bc56a2e
parent78b6a9a3f445e121ca08195084206cb8faa6999f (diff)
RDMA/rxe: Fix double unlock in rxe_qp.c
A recent patch can cause a double spin_unlock_bh() in rxe_qp_to_attr() at line 715 in rxe_qp.c. Move the 2nd unlock into the if statement. Fixes: f605f26ea196 ("RDMA/rxe: Protect QP state with qp->state_lock") Link: https://lore.kernel.org/r/[email protected] Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected] Signed-off-by: Bob Pearson <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
-rw-r--r--drivers/infiniband/sw/rxe/rxe_qp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index c5451a4488ca..245dd36638c7 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -712,8 +712,9 @@ int rxe_qp_to_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask)
if (qp->attr.sq_draining) {
spin_unlock_bh(&qp->state_lock);
cond_resched();
+ } else {
+ spin_unlock_bh(&qp->state_lock);
}
- spin_unlock_bh(&qp->state_lock);
return 0;
}