summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2019-04-17 14:44:23 -0700
committerMartin K. Petersen <martin.petersen@oracle.com>2019-04-29 17:24:50 -0400
commitdc035d4e934e586a663cbef0cf7ea3900e12bb7d (patch)
tree7fc2c79787c2bafaa32954933cdeccdc5fd6f757 /drivers/scsi/qla2xxx
parent5365bf99e360bf3c31f2d5ba8f20f60dd47f6a86 (diff)
downloadlinux-dc035d4e934e586a663cbef0cf7ea3900e12bb7d.tar.bz2
scsi: qla2xxx: Avoid that qla2x00_mem_free() crashes if called twice
Clear each pointer after having freed memory such that it becomes safe to call qla2x00_mem_free() twice. Cc: Himanshu Madhani <hmadhani@marvell.com> Cc: Giridhar Malavali <gmalavali@marvell.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: Himanshu Madhani <hmadhani@marvell.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index b90eed1c989e..6d5dfe12760e 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -4715,6 +4715,8 @@ qla2x00_mem_free(struct qla_hw_data *ha)
if (ha->flt)
dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE,
ha->flt, ha->flt_dma);
+ ha->flt = NULL;
+ ha->flt_dma = 0;
if (ha->ms_iocb)
dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma);
@@ -4790,6 +4792,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
if (ha->dif_bundl_pool)
dma_pool_destroy(ha->dif_bundl_pool);
+ ha->dif_bundl_pool = NULL;
qlt_mem_free(ha);