Skip to content

Commit

Permalink
scsi: mpt3sas: fix possible memory leak.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Chaitra P B authored and Martin K. Petersen committed May 8, 2018
1 parent c1a6c5a commit 87b3576
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/scsi/mpt3sas/mpt3sas_scsih.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 87b3576

Please sign in to comment.