[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20251218121700.11316-1-islituo@gmail.com>
Date: Thu, 18 Dec 2025 20:17:00 +0800
From: Tuo Li <islituo@...il.com>
To: James.Bottomley@...senPartnership.com,
martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Tuo Li <islituo@...il.com>
Subject: [PATCH] scsi: csiostor: Fix a possible null-pointer dereference in csio_eh_lun_reset_handler()
In this function, rn is checked by an if statement. If it is NULL,
execution transfers to the fail label. However, rn may still
be dereferenced later via the following macro:
CSIO_INC_STATS(rn, n_lun_rst_fail);
To avoid a potential null-pointer dereference, return FAILED directly when
rn is NULL, rather than transferring control to the common fail label.
Signed-off-by: Tuo Li <islituo@...il.com>
---
drivers/scsi/csiostor/csio_scsi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index 34bde6650fae..feb1a9a9390b 100644
--- a/drivers/scsi/csiostor/csio_scsi.c
+++ b/drivers/scsi/csiostor/csio_scsi.c
@@ -2074,7 +2074,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
struct csio_scsi_level_data sld;
if (!rn)
- goto fail;
+ return FAILED;
csio_dbg(hw, "Request to reset LUN:%llu (ssni:0x%x tgtid:%d)\n",
cmnd->device->lun, rn->flowid, rn->scsi_id);
--
2.43.0
Powered by blists - more mailing lists