• Dan Carpenter's avatar
    scsi: mpt3sas: Fix double free in attach error handling · ee560e7b
    Dan Carpenter authored
    The caller also calls _base_release_memory_pools() on error so it leads to
    a number of double frees:
    
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->chain_dma_pool' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->hpr_lookup' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->internal_lookup' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->pcie_sgl_dma_pool' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->reply_dma_pool' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->reply_free_dma_pool' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->reply_post_free_array_dma_pool' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->reply_post_free_dma_pool' double freed
    drivers/scsi/mpt3sas/mpt3sas_base.c:7207 mpt3sas_base_attach() warn: 'ioc->sense_dma_pool' double freed
    
    Fixes: 74522a92 ("scsi: mpt3sas: Optimize I/O memory consumption in driver.")
    Link: https://lore.kernel.org/r/20191203093652.gyntgvnkw2udatyc@kili.mountainSigned-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
    Acked-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    ee560e7b
mpt3sas_base.c 213 KB