* [PATCH] nvme-rdma: fix crash due to incorrect cqe
@ 2020-10-12 8:55 Chao Leng
2020-10-13 22:23 ` Sagi Grimberg
2020-10-15 8:10 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Chao Leng @ 2020-10-12 8:55 UTC (permalink / raw)
To: linux-nvme; +Cc: kbusch, axboe, hch, lengchao, sagi
A crash happened due to injecting error test. The cqe has incorrect
command id, host may find a request which already be freed.
req->mr->rkey cause a crash in nvme_rdma_process_nvme_rsp.
Because the mr is already freed.
Add a check for the mr to fix it.
Signed-off-by: Chao Leng <lengchao@huawei.com>
---
drivers/nvme/host/rdma.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 9e378d0a0c01..70dbc289d22e 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1730,10 +1730,11 @@ static void nvme_rdma_process_nvme_rsp(struct nvme_rdma_queue *queue,
req->result = cqe->result;
if (wc->wc_flags & IB_WC_WITH_INVALIDATE) {
- if (unlikely(wc->ex.invalidate_rkey != req->mr->rkey)) {
+ if (unlikely(!req->mr ||
+ wc->ex.invalidate_rkey != req->mr->rkey)) {
dev_err(queue->ctrl->ctrl.device,
"Bogus remote invalidation for rkey %#x\n",
- req->mr->rkey);
+ req->mr ? req->mr->rkey : 0);
nvme_rdma_error_recovery(queue->ctrl);
}
} else if (req->mr) {
--
2.16.4
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-rdma: fix crash due to incorrect cqe
2020-10-12 8:55 [PATCH] nvme-rdma: fix crash due to incorrect cqe Chao Leng
@ 2020-10-13 22:23 ` Sagi Grimberg
2020-10-15 8:10 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2020-10-13 22:23 UTC (permalink / raw)
To: Chao Leng, linux-nvme; +Cc: kbusch, axboe, hch
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-rdma: fix crash due to incorrect cqe
2020-10-12 8:55 [PATCH] nvme-rdma: fix crash due to incorrect cqe Chao Leng
2020-10-13 22:23 ` Sagi Grimberg
@ 2020-10-15 8:10 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2020-10-15 8:10 UTC (permalink / raw)
To: Chao Leng; +Cc: kbusch, axboe, hch, linux-nvme, sagi
Applied to nvme-5.10, thanks.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-15 8:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 8:55 [PATCH] nvme-rdma: fix crash due to incorrect cqe Chao Leng
2020-10-13 22:23 ` Sagi Grimberg
2020-10-15 8:10 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).