]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
scsi: mpt3sas: fix possible memory leak.
authorChaitra P B <chaitra.basappa@broadcom.com>
Tue, 24 Apr 2018 09:28:42 +0000 (05:28 -0400)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 8 May 2018 04:40:05 +0000 (00:40 -0400)
In ioctl exit path driver refers ioc_list to free memory associated with
diag buffers and event_log pointer used to save events by driver.
If ctl_exit() func is called after unregistering driver, then ioc_list will
be empty and hence driver will not be able to free the allocated memory
which in turn causes memory leak.
So call ctl_exit() function before unregistering mpt3sas driver.

Signed-off-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Suganath Prabu S <suganath-prabu.subramani@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/mpt3sas/mpt3sas_scsih.c

index 3dd70de581324ec533ca22001e87f82ed091665c..b8d131a455d01c207057d06d79c3d57ae2cdada5 100644 (file)
@@ -11287,10 +11287,10 @@ _mpt3sas_exit(void)
        pr_info("mpt3sas version %s unloading\n",
                                MPT3SAS_DRIVER_VERSION);
 
-       pci_unregister_driver(&mpt3sas_driver);
-
        mpt3sas_ctl_exit(hbas_to_enumerate);
 
+       pci_unregister_driver(&mpt3sas_driver);
+
        scsih_exit();
 }