* [PATCH] scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy()
@ 2019-12-18 13:45 Varun Prakash
2019-12-19 23:48 ` Martin K. Petersen
0 siblings, 1 reply; 2+ messages in thread
From: Varun Prakash @ 2019-12-18 13:45 UTC (permalink / raw)
To: martin.petersen; +Cc: linux-scsi, dt, ganji.aravind, varun
If cxgb4i_ddp_init() fails then cdev->cdev2ppm will be NULL,
so add a check for NULL pointer before dereferencing it.
Signed-off-by: Varun Prakash <varun@chelsio.com>
---
drivers/scsi/cxgbi/libcxgbi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index c4e4b01..4bc794d 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -121,7 +121,8 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev)
"cdev 0x%p, p# %u.\n", cdev, cdev->nports);
cxgbi_hbas_remove(cdev);
cxgbi_device_portmap_cleanup(cdev);
- cxgbi_ppm_release(cdev->cdev2ppm(cdev));
+ if (cdev->cdev2ppm)
+ cxgbi_ppm_release(cdev->cdev2ppm(cdev));
if (cdev->pmap.max_connect)
cxgbi_free_big_mem(cdev->pmap.port_csk);
kfree(cdev);
--
2.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy()
2019-12-18 13:45 [PATCH] scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy() Varun Prakash
@ 2019-12-19 23:48 ` Martin K. Petersen
0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2019-12-19 23:48 UTC (permalink / raw)
To: Varun Prakash; +Cc: martin.petersen, linux-scsi, dt, ganji.aravind
Varun,
> If cxgb4i_ddp_init() fails then cdev->cdev2ppm will be NULL,
> so add a check for NULL pointer before dereferencing it.
Applied to 5.5/scsi-fixes, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-19 23:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-18 13:45 [PATCH] scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy() Varun Prakash
2019-12-19 23:48 ` 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;
as well as URLs for NNTP newsgroup(s).