Commit dc035d4e authored by Bart Van Assche's avatar Bart Van Assche Committed by Martin K. Petersen

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: default avatarBart Van Assche <bvanassche@acm.org>
Acked-by: default avatarHimanshu Madhani <hmadhani@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 5365bf99
...@@ -4715,6 +4715,8 @@ qla2x00_mem_free(struct qla_hw_data *ha) ...@@ -4715,6 +4715,8 @@ qla2x00_mem_free(struct qla_hw_data *ha)
if (ha->flt) if (ha->flt)
dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE, dma_free_coherent(&ha->pdev->dev, SFP_DEV_SIZE,
ha->flt, ha->flt_dma); ha->flt, ha->flt_dma);
ha->flt = NULL;
ha->flt_dma = 0;
if (ha->ms_iocb) if (ha->ms_iocb)
dma_pool_free(ha->s_dma_pool, ha->ms_iocb, ha->ms_iocb_dma); 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) ...@@ -4790,6 +4792,7 @@ qla2x00_mem_free(struct qla_hw_data *ha)
if (ha->dif_bundl_pool) if (ha->dif_bundl_pool)
dma_pool_destroy(ha->dif_bundl_pool); dma_pool_destroy(ha->dif_bundl_pool);
ha->dif_bundl_pool = NULL;
qlt_mem_free(ha); qlt_mem_free(ha);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment