Skip to contentSkip to conversation

scsi: esas2r: prevent a potential NULL dereference in esas2r_probe()

PATCH In review Jing Xiangfeng 2 participants 4 messages Sep 9, 2020 – Sep 30, 2020

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

PATCH 1/1 scsi: esas2r: prevent a potential NULL dereference in esas2r_probe()

esas2r_probe() calls scsi_host_put() in an error path. However, esas2r_log_dev() may hit a potential NULL dereference. So use NUll instead.

---
 drivers/scsi/esas2r/esas2r_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/esas2r/esas2r_main.c +1 -1
index 7b49e2e9fcde..7d3fa9dac4ce 100644
@@ -456,7 +456,7 @@ static int esas2r_probe(struct pci_dev *pcid,
 
 		scsi_host_put(host);
 
-		esas2r_log_dev(ESAS2R_LOG_INFO, &(host->shost_gendev),
+		esas2r_log_dev(ESAS2R_LOG_INFO, NULL,
 			       "pci_set_drvdata(%p, NULL) called",
 			       pcid);
 
Signature · 1 line
2.17.1
#1 lore raw

Jing,

Quoted 2 lines

esas2r_probe() calls scsi_host_put() in an error path. However, esas2r_log_dev() may hit a potential NULL dereference. So use NUll instead.

Wouldn't it be better to move the scsi_host_put() call after the error message?

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
Quoted 8 lines · Martin K. Petersen

Jing,

Quoted 2 lines

esas2r_probe() calls scsi_host_put() in an error path. However, esas2r_log_dev() may hit a potential NULL dereference. So use NUll instead.

Wouldn't it be better to move the scsi_host_put() call after the error message?

There is already a message before the scsi_host_put() call. It is used to record calling function.

Quoted 1 line
#3 lore raw
In reply to Martin K. Petersen
Quoted 8 lines · Martin K. Petersen

Jing,

Quoted 2 lines

esas2r_probe() calls scsi_host_put() in an error path. However, esas2r_log_dev() may hit a potential NULL dereference. So use NUll instead.

Wouldn't it be better to move the scsi_host_put() call after the error message?

There is already a message before the scsi_host_put() call. It is used to record calling function.

Quoted 1 line