Skip to content

Commit

Permalink
scsi: qla2xxx: Avoid that qla2x00_mem_free() crashes if called twice
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bart Van Assche authored and Martin K. Petersen committed Apr 29, 2019
1 parent 5365bf9 commit dc035d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/scsi/qla2xxx/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit dc035d4

Please sign in to comment.