2013-05-13 02:30:06

by Wei Yongjun

[permalink] [raw]
Subject: [PATCH] NVMe: fix error return code in nvme_submit_bio_queue()

From: Wei Yongjun <[email protected]>

Fix to return -ENOMEM in the nvem iod alloc error handling case instead
of 0(possible overwrite to 0 by above nvme_submit_flush_data()), as done
elsewhere in this function.

Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/block/nvme-core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 8efdfaa..750c337 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -629,7 +629,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
struct nvme_command *cmnd;
struct nvme_iod *iod;
enum dma_data_direction dma_dir;
- int cmdid, length, result = -ENOMEM;
+ int cmdid, length, result;
u16 control;
u32 dsmgmt;
int psegs = bio_phys_segments(ns->queue, bio);
@@ -641,8 +641,10 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
}

iod = nvme_alloc_iod(psegs, bio->bi_size, GFP_ATOMIC);
- if (!iod)
+ if (!iod) {
+ result = -ENOMEM;
goto nomem;
+ }
iod->private = bio;

result = -EBUSY;


2013-05-13 13:51:47

by Matthew Wilcox

[permalink] [raw]
Subject: RE: [PATCH] NVMe: fix error return code in nvme_submit_bio_queue()

I can't apply this patch. Instead of following what it says in MAINTAINERS, you've sent it to my Exchange address. And now it's all mangled.

NVM EXPRESS DRIVER
M: Matthew Wilcox <[email protected]>
L: [email protected]

________________________________________
From: Wei Yongjun [[email protected]]
Sent: May 12, 2013 7:30 PM
To: Wilcox, Matthew R; Busch, Keith; Verma, Vishal L
Cc: [email protected]; [email protected]
Subject: [PATCH] NVMe: fix error return code in nvme_submit_bio_queue()

From: Wei Yongjun <[email protected]>

Fix to return -ENOMEM in the nvem iod alloc error handling case instead
of 0(possible overwrite to 0 by above nvme_submit_flush_data()), as done
elsewhere in this function.

Signed-off-by: Wei Yongjun <[email protected]>
---
drivers/block/nvme-core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index 8efdfaa..750c337 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -629,7 +629,7 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
struct nvme_command *cmnd;
struct nvme_iod *iod;
enum dma_data_direction dma_dir;
- int cmdid, length, result = -ENOMEM;
+ int cmdid, length, result;
u16 control;
u32 dsmgmt;
int psegs = bio_phys_segments(ns->queue, bio);
@@ -641,8 +641,10 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
}

iod = nvme_alloc_iod(psegs, bio->bi_size, GFP_ATOMIC);
- if (!iod)
+ if (!iod) {
+ result = -ENOMEM;
goto nomem;
+ }
iod->private = bio;

result = -EBUSY;