summaryrefslogtreecommitdiff
path: root/drivers/scsi/mpi3mr
diff options
context:
space:
mode:
authorTomas Henzl <thenzl@redhat.com>2023-03-03 02:43:34 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2023-03-08 05:17:23 +0300
commitd4caa1a4255cc44be56bcab3db2c97c632e6cc10 (patch)
treebc03181fd55e7dca6bf61693a86e24b0be98dfdc /drivers/scsi/mpi3mr
parentd0f3c3728da8af76dfe435f7f0cfa2b9d9e43ef0 (diff)
downloadlinux-d4caa1a4255cc44be56bcab3db2c97c632e6cc10.tar.xz
scsi: mpi3mr: Fix sas_hba.phy memory leak in mpi3mr_remove()
Free mrioc->sas_hba.phy at .remove. Fixes: 42fc9fee116f ("scsi: mpi3mr: Add helper functions to manage device's port") Signed-off-by: Tomas Henzl <thenzl@redhat.com> Link: https://lore.kernel.org/r/20230302234336.25456-5-thenzl@redhat.com Acked-by: Sathya Prakash Veerichetty <sathya.prakash@broadcom.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/mpi3mr')
-rw-r--r--drivers/scsi/mpi3mr/mpi3mr_os.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index 2ad03b993f05..2e546c80d98c 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -5128,6 +5128,12 @@ static void mpi3mr_remove(struct pci_dev *pdev)
}
spin_unlock_irqrestore(&mrioc->sas_node_lock, flags);
+ if (mrioc->sas_hba.num_phys) {
+ kfree(mrioc->sas_hba.phy);
+ mrioc->sas_hba.phy = NULL;
+ mrioc->sas_hba.num_phys = 0;
+ }
+
spin_lock(&mrioc_list_lock);
list_del(&mrioc->list);
spin_unlock(&mrioc_list_lock);