* [PATCH] scsi: esas2r: prevent a potential NULL dereference in esas2r_probe()
@ 2020-09-09 8:46 Jing Xiangfeng
2020-09-15 21:44 ` Martin K. Petersen
0 siblings, 1 reply; 4+ messages in thread
From: Jing Xiangfeng @ 2020-09-09 8:46 UTC (permalink / raw)
To: linuxdrivers, jejb, martin.petersen
Cc: linux-scsi, linux-kernel, jingxiangfeng
esas2r_probe() calls scsi_host_put() in an error path. However,
esas2r_log_dev() may hit a potential NULL dereference. So use NUll instead.
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
---
drivers/scsi/esas2r/esas2r_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/esas2r/esas2r_main.c b/drivers/scsi/esas2r/esas2r_main.c
index 7b49e2e9fcde..7d3fa9dac4ce 100644
--- a/drivers/scsi/esas2r/esas2r_main.c
+++ b/drivers/scsi/esas2r/esas2r_main.c
@@ -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);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: esas2r: prevent a potential NULL dereference in esas2r_probe()
2020-09-09 8:46 [PATCH] scsi: esas2r: prevent a potential NULL dereference in esas2r_probe() Jing Xiangfeng
@ 2020-09-15 21:44 ` Martin K. Petersen
2020-09-16 12:13 ` Jing Xiangfeng
2020-09-16 12:28 ` Jing Xiangfeng
0 siblings, 2 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-09-15 21:44 UTC (permalink / raw)
To: Jing Xiangfeng
Cc: linuxdrivers, jejb, martin.petersen, linux-scsi, linux-kernel
Jing,
> 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?
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: esas2r: prevent a potential NULL dereference in esas2r_probe()
2020-09-15 21:44 ` Martin K. Petersen
@ 2020-09-16 12:13 ` Jing Xiangfeng
2020-09-16 12:28 ` Jing Xiangfeng
1 sibling, 0 replies; 4+ messages in thread
From: Jing Xiangfeng @ 2020-09-16 12:13 UTC (permalink / raw)
To: Martin K. Petersen; +Cc: linuxdrivers, jejb, linux-scsi, linux-kernel
On 2020/9/16 5:44, Martin K. Petersen wrote:
>
> Jing,
>
>> 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.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi: esas2r: prevent a potential NULL dereference in esas2r_probe()
2020-09-15 21:44 ` Martin K. Petersen
2020-09-16 12:13 ` Jing Xiangfeng
@ 2020-09-16 12:28 ` Jing Xiangfeng
1 sibling, 0 replies; 4+ messages in thread
From: Jing Xiangfeng @ 2020-09-16 12:28 UTC (permalink / raw)
To: Martin K. Petersen; +Cc: linuxdrivers, jejb, linux-scsi, linux-kernel
On 2020/9/16 5:44, Martin K. Petersen wrote:
>
> Jing,
>
>> 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.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-30 0:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 8:46 [PATCH] scsi: esas2r: prevent a potential NULL dereference in esas2r_probe() Jing Xiangfeng
2020-09-15 21:44 ` Martin K. Petersen
2020-09-16 12:13 ` Jing Xiangfeng
2020-09-16 12:28 ` Jing Xiangfeng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.