Skip to content

Commit 71482fd

Browse files
Varun Prakashmartinkpetersen
authored andcommitted
scsi: libcxgbi: fix NULL pointer dereference in cxgbi_device_destroy()
If cxgb4i_ddp_init() fails then cdev->cdev2ppm will be NULL, so add a check for NULL pointer before dereferencing it. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Varun Prakash <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 291c254 commit 71482fd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/cxgbi/libcxgbi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ static inline void cxgbi_device_destroy(struct cxgbi_device *cdev)
121121
"cdev 0x%p, p# %u.\n", cdev, cdev->nports);
122122
cxgbi_hbas_remove(cdev);
123123
cxgbi_device_portmap_cleanup(cdev);
124-
cxgbi_ppm_release(cdev->cdev2ppm(cdev));
124+
if (cdev->cdev2ppm)
125+
cxgbi_ppm_release(cdev->cdev2ppm(cdev));
125126
if (cdev->pmap.max_connect)
126127
cxgbi_free_big_mem(cdev->pmap.port_csk);
127128
kfree(cdev);

0 commit comments

Comments
 (0)