public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Chaitra P B <chaitra.basappa@broadcom.com>
To: linux-scsi@vger.kernel.org, stable@vger.kernel.org
Cc: suganath-prabu.subramani@broadcom.com,
	Sathya.Prakash@broadcom.com, sreekanth.reddy@broadcom.com,
	Chaitra P B <chaitra.basappa@broadcom.com>
Subject: [PATCH 14/15] mpt3sas: fix possible memory leak.
Date: Fri, 30 Mar 2018 15:07:23 +0530	[thread overview]
Message-ID: <1522402644-3016-15-git-send-email-chaitra.basappa@broadcom.com> (raw)
In-Reply-To: <1522402644-3016-1-git-send-email-chaitra.basappa@broadcom.com>

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>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index f5344cc..562b13d 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -11286,10 +11286,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();
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2018-03-30  9:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-30  9:37 [PATCH 00/15] mpt3sas: Enhancements and Defect fixes Chaitra P B
2018-03-30  9:37 ` [PATCH 01/15] mpt3sas: Fixed warnings Chaitra P B
2018-03-30  9:37 ` [PATCH 02/15] mpt3sas: Pre-allocate RDPQ Array at driver boot time Chaitra P B
2018-03-30  9:37 ` [PATCH 03/15] mpt3sas: Add sanity checks for scsi tracker before accessing it Chaitra P B
2018-03-30 11:59   ` Christoph Hellwig
2018-04-02  6:23     ` Sreekanth Reddy
2018-04-02 15:25       ` Bart Van Assche
2018-04-03  4:41         ` Sreekanth Reddy
2018-04-03 15:56           ` Bart Van Assche
2018-04-04 12:28             ` Sreekanth Reddy
2018-03-30 15:54   ` Bart Van Assche
2018-03-30  9:37 ` [PATCH 04/15] mpt3sas: Lockless access for chain buffers Chaitra P B
2018-03-30  9:37 ` [PATCH 05/15] mpt3sas: Optimize I/O memory consumption in driver Chaitra P B
2018-03-30  9:37 ` [PATCH 06/15] mpt3sas: Enhanced handling of Sense Buffer Chaitra P B
2018-03-30  9:37 ` [PATCH 07/15] mpt3sas: Added support for SAS Device Discovery Error Event Chaitra P B
2018-03-30  9:37 ` [PATCH 08/15] mpt3sas: Increase event log buffer to support 24 port HBA's Chaitra P B
2018-03-30  9:37 ` [PATCH 09/15] mpt3sas: Allow processing of events during driver unload Chaitra P B
2018-03-30  9:37 ` [PATCH 10/15] mpt3sas: Cache enclosure pages during enclosure add Chaitra P B
2018-03-30  9:37 ` [PATCH 11/15] mpt3sas: Report Firmware Package Version from HBA Driver Chaitra P B
2018-03-31  8:44   ` kbuild test robot
2018-03-30  9:37 ` [PATCH 12/15] mpt3sas: Update MPI Headers Chaitra P B
2018-03-30  9:37 ` [PATCH 13/15] mpt3sas: For NVME device, issue a protocol level reset instead of hot reset and use TM timeout value exposed in PCIe Device Page 2 Chaitra P B
2018-03-30  9:37 ` Chaitra P B [this message]
2018-03-30  9:37 ` [PATCH 15/15] mpt3sas: Update driver version "25.100.00.00" Chaitra P B
2018-03-30  9:58 ` [PATCH 00/15] mpt3sas: Enhancements and Defect fixes Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1522402644-3016-15-git-send-email-chaitra.basappa@broadcom.com \
    --to=chaitra.basappa@broadcom.com \
    --cc=Sathya.Prakash@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sreekanth.reddy@broadcom.com \
    --cc=stable@vger.kernel.org \
    --cc=suganath-prabu.subramani@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox