diff options
author | Varun Prakash <varun@chelsio.com> | 2019-12-18 14:45:31 +0100 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-12-20 00:48:26 +0100 |
commit | 71482fde704efdd8c3abe0faf34d922c61e8d76b (patch) | |
tree | 8552373a938dbfee3853a6ec64adae22052fe702 /drivers | |
parent | scsi: lpfc: fix spelling mistakes of asynchronous (diff) | |
download | linux-71482fde704efdd8c3abe0faf34d922c61e8d76b.tar.xz linux-71482fde704efdd8c3abe0faf34d922c61e8d76b.zip |
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/1576676731-3068-1-git-send-email-varun@chelsio.com
Signed-off-by: Varun Prakash <varun@chelsio.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/cxgbi/libcxgbi.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 0d044c165960..dc9320f37ebf 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); |