[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <831d0d61-6d45-4184-81fc-38828f9e5d29@web.de>
Date: Wed, 27 Dec 2023 18:16:25 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-nvme@...ts.infradead.org, kernel-janitors@...r.kernel.org,
Chaitanya Kulkarni <kch@...dia.com>, Christoph Hellwig <hch@....de>,
James Smart <james.smart@...adcom.com>, Sagi Grimberg <sagi@...mberg.me>
Cc: LKML <linux-kernel@...r.kernel.org>, cocci@...ia.fr
Subject: [PATCH 1/2] nvmet-fc: One function call less in
nvmet_fc_alloc_ls_iodlist() after error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 27 Dec 2023 17:52:46 +0100
The kfree() function was called in one case by
the nvmet_fc_alloc_ls_iodlist() function during error handling
even if the passed data structure member contained a null pointer.
This issue was detected by using the Coccinelle software.
Thus use another label.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/nvme/target/fc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index bd59990b5250..856a68404f32 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -553,7 +553,7 @@ nvmet_fc_alloc_ls_iodlist(struct nvmet_fc_tgtport *tgtport)
sizeof(union nvmefc_ls_responses),
GFP_KERNEL);
if (!iod->rqstbuf)
- goto out_fail;
+ goto out_delete_entry;
iod->rspbuf = (union nvmefc_ls_responses *)&iod->rqstbuf[1];
@@ -568,6 +568,7 @@ nvmet_fc_alloc_ls_iodlist(struct nvmet_fc_tgtport *tgtport)
out_fail:
kfree(iod->rqstbuf);
+out_delete_entry:
list_del(&iod->ls_rcv_list);
for (iod--, i--; i >= 0; iod--, i--) {
fc_dma_unmap_single(tgtport->dev, iod->rspdma,
--
2.43.0
Powered by blists - more mailing lists