lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190712224207.22061-1-logang@deltatee.com>
Date:   Fri, 12 Jul 2019 16:42:07 -0600
From:   Logan Gunthorpe <logang@...tatee.com>
To:     linux-kernel@...r.kernel.org
Cc:     Christoph Hellwig <hch@....de>, Sagi Grimberg <sagi@...mberg.me>,
        Logan Gunthorpe <logang@...tatee.com>,
        Chaitanya Kulkarni <chaitanya.kulkarni@....com>
Subject: [PATCH] nvmet-file: fix nvmet_file_flush() always returning an error

errno_to_nvme_status() doesn't take into account the case
when errno=0, all other use cases only call it if there is actually
an error.

Presently, nvmet_file_flush() always returns a call to
errno_to_nvme_status() so, even if it is successful, it will
return NVME_SC_INTERNAL.

This bug was found while trying to get the existing blktests to pass.

Fixes: c6aa3542e010 ("nvmet: add error log support for file backend")
Signed-off-by: Logan Gunthorpe <logang@...tatee.com>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@....com>
---
 drivers/nvme/target/io-cmd-file.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/io-cmd-file.c b/drivers/nvme/target/io-cmd-file.c
index 05453f5d1448..fec17c66b8cd 100644
--- a/drivers/nvme/target/io-cmd-file.c
+++ b/drivers/nvme/target/io-cmd-file.c
@@ -261,7 +261,13 @@ static void nvmet_file_execute_rw(struct nvmet_req *req)
 
 u16 nvmet_file_flush(struct nvmet_req *req)
 {
-	return errno_to_nvme_status(req, vfs_fsync(req->ns->file, 1));
+	int ret;
+
+	ret = vfs_fsync(req->ns->file, 1);
+	if (ret)
+		return errno_to_nvme_status(req, ret);
+
+	return NVME_SC_SUCCESS;
 }
 
 static void nvmet_file_flush_work(struct work_struct *w)
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ