Skip to content

Commit 4e05a4b

Browse files
rpearsonhpe-designjgunthorpe
authored andcommitted
RDMA/rxe: Check rxe_get() return value
In the tasklets (completer, responder, and requester) check the return value from rxe_get() to detect failures to get a reference. This only occurs if the qp has had its reference count drop to zero which indicates that it no longer should be used. The ref is never 0 today because the tasklets are flushed before the ref is dropped. The next patch changes this so that the ref is dropped then the tasklets are flushed. Link: https://lore.kernel.org/r/20220421014042.26985-4-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
1 parent b2a4167 commit 4e05a4b

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/infiniband/sw/rxe/rxe_comp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,8 @@ int rxe_completer(void *arg)
562562
enum comp_state state;
563563
int ret = 0;
564564

565-
rxe_get(qp);
565+
if (!rxe_get(qp))
566+
return -EAGAIN;
566567

567568
if (!qp->valid || qp->req.state == QP_STATE_ERROR ||
568569
qp->req.state == QP_STATE_RESET) {

drivers/infiniband/sw/rxe/rxe_req.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,8 @@ int rxe_requester(void *arg)
606606
struct rxe_ah *ah;
607607
struct rxe_av *av;
608608

609-
rxe_get(qp);
609+
if (!rxe_get(qp))
610+
return -EAGAIN;
610611

611612
next_wqe:
612613
if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR))

drivers/infiniband/sw/rxe/rxe_resp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1247,7 +1247,8 @@ int rxe_responder(void *arg)
12471247
struct rxe_pkt_info *pkt = NULL;
12481248
int ret = 0;
12491249

1250-
rxe_get(qp);
1250+
if (!rxe_get(qp))
1251+
return -EAGAIN;
12511252

12521253
qp->resp.aeth_syndrome = AETH_ACK_UNLIMITED;
12531254

0 commit comments

Comments
 (0)