Skip to content

Commit d4caa1a

Browse files
thenzlmartinkpetersen
authored andcommitted
scsi: mpi3mr: Fix sas_hba.phy memory leak in mpi3mr_remove()
Free mrioc->sas_hba.phy at .remove. Fixes: 42fc9fe ("scsi: mpi3mr: Add helper functions to manage device's port") Signed-off-by: Tomas Henzl <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Sathya Prakash Veerichetty <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent d0f3c37 commit d4caa1a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/scsi/mpi3mr/mpi3mr_os.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5128,6 +5128,12 @@ static void mpi3mr_remove(struct pci_dev *pdev)
51285128
}
51295129
spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
51305130

5131+
if (mrioc->sas_hba.num_phys) {
5132+
kfree(mrioc->sas_hba.phy);
5133+
mrioc->sas_hba.phy = NULL;
5134+
mrioc->sas_hba.num_phys = 0;
5135+
}
5136+
51315137
spin_lock(&mrioc_list_lock);
51325138
list_del(&mrioc->list);
51335139
spin_unlock(&mrioc_list_lock);

0 commit comments

Comments
 (0)