提交 1974b1ae 编写于 作者: M Matthew Wilcox

NVMe: Check for DMA mapping failure

If dma_map_sg returns 0 (failure), we need to fail the I/O.
Signed-off-by: NMatthew Wilcox <matthew.r.wilcox@intel.com>
上级 d567760c
......@@ -451,7 +451,8 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
dma_dir = DMA_FROM_DEVICE;
}
nvme_map_bio(nvmeq->q_dmadev, nbio, bio, dma_dir, psegs);
if (nvme_map_bio(nvmeq->q_dmadev, nbio, bio, dma_dir, psegs) == 0)
goto mapping_failed;
cmnd->rw.flags = 1;
cmnd->rw.command_id = cmdid;
......@@ -471,6 +472,11 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
return 0;
mapping_failed:
free_nbio(nvmeq, nbio);
bio_endio(bio, -ENOMEM);
return 0;
free_nbio:
free_nbio(nvmeq, nbio);
congestion:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册