diff options
author | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-02-10 12:01:09 -0500 |
---|---|---|
committer | Matthew Wilcox <matthew.r.wilcox@intel.com> | 2011-11-04 15:52:57 -0400 |
commit | 1974b1ae8852324a75fb8cfecbc7b758fd5a2c3c (patch) | |
tree | ef469e03be53c3334d6cfd93d92f11b06c025538 /drivers/block | |
parent | d567760c409f981d35fc755b51d5bf56a99a467b (diff) | |
download | blackbird-op-linux-1974b1ae8852324a75fb8cfecbc7b758fd5a2c3c.tar.gz blackbird-op-linux-1974b1ae8852324a75fb8cfecbc7b758fd5a2c3c.zip |
NVMe: Check for DMA mapping failure
If dma_map_sg returns 0 (failure), we need to fail the I/O.
Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/nvme.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c index 2948043483fe..bfdca3a3a41a 100644 --- a/drivers/block/nvme.c +++ b/drivers/block/nvme.c @@ -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: |