Skip to contentSkip to conversation

nvme: add missing error returns in format unit scsi translation

PATCH New Akinobu Mita 1 participant 1 message Jun 8, 2016 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme: add missing error returns in format unit scsi translation

The Format Unit SCSI command emulation attempts to do sanity checks for the block size and number before issuing the Format NVM NVMe command. But the sanity checks lack the actual error return statements and the conditions have been ignored.

Signed-off-by Akinobu Mita <akinobu.mita at gmail.com>
Cc Keith Busch <keith.busch at intel.com>
Cc Jens Axboe <axboe at fb.com>
---
 drivers/nvme/host/scsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/host/scsi.c +3 -1
index e947e29..e95ab2b9 100644
@@ -1619,11 +1619,13 @@ static int nvme_trans_fmt_send_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr,
 		res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION,
 				ILLEGAL_REQUEST, SCSI_ASC_INVALID_PARAMETER,
 				SCSI_ASCQ_CAUSE_NOT_REPORTABLE);
+		goto out;
 	}
 	if (ns->mode_select_num_blocks != le64_to_cpu(id_ns->ncap)) {
 		res = nvme_trans_completion(hdr, SAM_STAT_CHECK_CONDITION,
 				ILLEGAL_REQUEST, SCSI_ASC_INVALID_PARAMETER,
 				SCSI_ASCQ_CAUSE_NOT_REPORTABLE);
+		goto out;
 	}
 
 	cdw10 |= prot_info << 5;
@@ -1635,7 +1637,7 @@ static int nvme_trans_fmt_send_cmd(struct nvme_ns *ns, struct sg_io_hdr *hdr,
 
 	nvme_sc = nvme_submit_sync_cmd(ns->ctrl->admin_q, &c, NULL, 0);
 	res = nvme_trans_status_code(hdr, nvme_sc);
-
+out:
 	kfree(id_ns);
 	return res;
 }
Signature · 1 line
2.7.4