Skip to content

Commit d7dcdf9

Browse files
Israel RukshinChristoph Hellwig
authored andcommitted
nvmet-rdma: fix response use after free
nvmet_rdma_release_rsp() may free the response before using it at error flow. Fixes: 8407879 ("nvmet-rdma: fix possible bogus dereference under heavy load") Signed-off-by: Israel Rukshin <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Max Gurtovoy <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 86880d6 commit d7dcdf9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/target/rdma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,14 +529,15 @@ static void nvmet_rdma_send_done(struct ib_cq *cq, struct ib_wc *wc)
529529
{
530530
struct nvmet_rdma_rsp *rsp =
531531
container_of(wc->wr_cqe, struct nvmet_rdma_rsp, send_cqe);
532+
struct nvmet_rdma_queue *queue = cq->cq_context;
532533

533534
nvmet_rdma_release_rsp(rsp);
534535

535536
if (unlikely(wc->status != IB_WC_SUCCESS &&
536537
wc->status != IB_WC_WR_FLUSH_ERR)) {
537538
pr_err("SEND for CQE 0x%p failed with status %s (%d).\n",
538539
wc->wr_cqe, ib_wc_status_msg(wc->status), wc->status);
539-
nvmet_rdma_error_comp(rsp->queue);
540+
nvmet_rdma_error_comp(queue);
540541
}
541542
}
542543

0 commit comments

Comments
 (0)