diff options
author | Andrew Boyer <andrew.boyer@dell.com> | 2016-12-05 14:43:21 +0100 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-12-12 22:34:22 +0100 |
commit | 37f69f43fb5aba4288d38ea32bbe0dfdb412c763 (patch) | |
tree | e7d01aaa85ce347d6858ad09c3369b0580b2ccd2 /drivers/infiniband/sw/rxe/rxe_comp.c | |
parent | IB/rxe: Wait for tasklets to finish before tearing down QP (diff) | |
download | linux-37f69f43fb5aba4288d38ea32bbe0dfdb412c763.tar.xz linux-37f69f43fb5aba4288d38ea32bbe0dfdb412c763.zip |
IB/rxe: Hold refs when running tasklets
It might be possible for all of a QP's references to be dropped
while one of that QP's tasklets is running.
For example, the completer might run during QP destroy.
If qp->valid is false, it will drop all of the packets on
the resp_pkts list, potentially removing the last reference.
Then it tries to advance the SQ consumer pointer. If the
SQ's buffer has already been destroyed, the system will
panic.
To be safe, hold a reference on the QP for the duration
of each tasklet.
Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_comp.c')
-rw-r--r-- | drivers/infiniband/sw/rxe/rxe_comp.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c index d46c49b33b13..cd27cbde7652 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -511,6 +511,8 @@ int rxe_completer(void *arg) struct rxe_pkt_info *pkt = NULL; enum comp_state state; + rxe_add_ref(qp); + if (!qp->valid) { while ((skb = skb_dequeue(&qp->resp_pkts))) { rxe_drop_ref(qp); @@ -740,11 +742,13 @@ exit: /* we come here if we are done with processing and want the task to * exit from the loop calling us */ + rxe_drop_ref(qp); return -EAGAIN; done: /* we come here if we have processed a packet we want the task to call * us again to see if there is anything else to do */ + rxe_drop_ref(qp); return 0; } |