From: Tomas Henzl Date: Thu, 2 Mar 2023 23:43:32 +0000 (+0100) Subject: scsi: mpi3mr: Fix config page DMA memory leak X-Git-Tag: baikal/mips/sdk6.1~184 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=4e8da769e8b631e194cbc98009c9436d7a976a91;p=kernel.git scsi: mpi3mr: Fix config page DMA memory leak [ Upstream commit b9c874a69db75f4900f45fcffc569b884178f8b7 ] A fix for: DMA-API: pci 0000:83:00.0: device driver has pending DMA allocations while released from device [count=1] Fixes: 14ae28221a98 ("scsi: mpi3mr: Add framework to issue config requests") Signed-off-by: Tomas Henzl Link: https://lore.kernel.org/r/20230302234336.25456-3-thenzl@redhat.com Acked-by: Sathya Prakash Veerichetty Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- diff --git a/drivers/scsi/mpi3mr/mpi3mr_fw.c b/drivers/scsi/mpi3mr/mpi3mr_fw.c index 2d46a0b04f345..f6b726359a1cc 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_fw.c +++ b/drivers/scsi/mpi3mr/mpi3mr_fw.c @@ -4351,7 +4351,11 @@ void mpi3mr_free_mem(struct mpi3mr_ioc *mrioc) mrioc->admin_req_base, mrioc->admin_req_dma); mrioc->admin_req_base = NULL; } - + if (mrioc->cfg_page) { + dma_free_coherent(&mrioc->pdev->dev, mrioc->cfg_page_sz, + mrioc->cfg_page, mrioc->cfg_page_dma); + mrioc->cfg_page = NULL; + } if (mrioc->pel_seqnum_virt) { dma_free_coherent(&mrioc->pdev->dev, mrioc->pel_seqnum_sz, mrioc->pel_seqnum_virt, mrioc->pel_seqnum_dma);