Skip to contentSkip to conversation

scsi: csiostor: Fix dereference of null pointer rn

PATCH Applied Colin Ian King 2 participants 3 messages Jan 29 – Feb 8

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: csiostor: Fix dereference of null pointer rn

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")
---
 drivers/scsi/csiostor/csio_scsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/csiostor/csio_scsi.c +2 -1
index c29bf2807e31..05137784f369 100644
@@ -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;
 }
 
Signature · 1 line
2.47.3
#1 lore raw

Colin,

Quoted 4 lines

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.

Applied to 6.20/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen
#2 lore raw
In reply to Colin Ian King
Quoted 6 lines · Colin Ian King

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.

Applied to 6.20/scsi-queue, thanks!

[1/1] scsi: csiostor: Fix dereference of null pointer rn

      https://git.kernel.org/mkp/scsi/c/1982257570b8
Signature · 1 line
Martin K. Petersen