Commit 4e05a4b3 authored by Bob Pearson's avatar Bob Pearson Committed by Jason Gunthorpe

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.comSigned-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent b2a41678
...@@ -562,7 +562,8 @@ int rxe_completer(void *arg) ...@@ -562,7 +562,8 @@ int rxe_completer(void *arg)
enum comp_state state; enum comp_state state;
int ret = 0; int ret = 0;
rxe_get(qp); if (!rxe_get(qp))
return -EAGAIN;
if (!qp->valid || qp->req.state == QP_STATE_ERROR || if (!qp->valid || qp->req.state == QP_STATE_ERROR ||
qp->req.state == QP_STATE_RESET) { qp->req.state == QP_STATE_RESET) {
......
...@@ -606,7 +606,8 @@ int rxe_requester(void *arg) ...@@ -606,7 +606,8 @@ int rxe_requester(void *arg)
struct rxe_ah *ah; struct rxe_ah *ah;
struct rxe_av *av; struct rxe_av *av;
rxe_get(qp); if (!rxe_get(qp))
return -EAGAIN;
next_wqe: next_wqe:
if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR)) if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR))
......
...@@ -1247,7 +1247,8 @@ int rxe_responder(void *arg) ...@@ -1247,7 +1247,8 @@ int rxe_responder(void *arg)
struct rxe_pkt_info *pkt = NULL; struct rxe_pkt_info *pkt = NULL;
int ret = 0; int ret = 0;
rxe_get(qp); if (!rxe_get(qp))
return -EAGAIN;
qp->resp.aeth_syndrome = AETH_ACK_UNLIMITED; qp->resp.aeth_syndrome = AETH_ACK_UNLIMITED;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment