public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scsi: csiostor: Fix dereference of null pointer rn
@ 2026-01-29 15:53 Colin Ian King
  2026-02-04  3:34 ` Martin K. Petersen
  2026-02-08  2:01 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Colin Ian King @ 2026-01-29 15:53 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen, Bart Van Assche,
	Naresh Kumar Inna, linux-scsi
  Cc: kernel-janitors, linux-kernel

The error exit path when rn is NULL ends up deferencing the null
pointer rn via the use of the macro CSIO_INC_STATS. Fix this by
adding a new error return path label after the use of the macro
to avoid the deference.

Fixes: a3667aaed569 ("[SCSI] csiostor: Chelsio FCoE offload driver")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/scsi/csiostor/csio_scsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/csiostor/csio_scsi.c b/drivers/scsi/csiostor/csio_scsi.c
index c29bf2807e31..05137784f369 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;
+		goto fail_ret;
 
 	csio_dbg(hw, "Request to reset LUN:%llu (ssni:0x%x tgtid:%d)\n",
 		      cmnd->device->lun, rn->flowid, rn->scsi_id);
@@ -2220,6 +2220,7 @@ csio_eh_lun_reset_handler(struct scsi_cmnd *cmnd)
 	csio_put_scsi_ioreq_lock(hw, scsim, ioreq);
 fail:
 	CSIO_INC_STATS(rn, n_lun_rst_fail);
+fail_ret:
 	return FAILED;
 }
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-02-08  2:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 15:53 [PATCH] scsi: csiostor: Fix dereference of null pointer rn Colin Ian King
2026-02-04  3:34 ` Martin K. Petersen
2026-02-08  2:01 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox