All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
To: martin.petersen@oracle.com
Cc: linux-scsi@vger.kernel.org,
	suganath-prabu.subramani@broadcom.com,
	sathya.prakash@broadcom.com,
	Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Subject: [PATCH 04/13] mpt3sas: Free diag buffer without any status check
Date: Fri, 13 Sep 2019 09:04:41 -0400	[thread overview]
Message-ID: <1568379890-18347-5-git-send-email-sreekanth.reddy@broadcom.com> (raw)
In-Reply-To: <1568379890-18347-1-git-send-email-sreekanth.reddy@broadcom.com>

Issue:
Memory leak can happen when diag buffer is released but not
unregistered(where buffer is deallocated) by the user.
since during module unload time driver is not deallocating
the buffer if the buffer is in released state.

Fix:
Deallocate the diag buffer during module unload time without
any diag buffer status checks.

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
---
 drivers/scsi/mpt3sas/mpt3sas_ctl.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index a195cae..9b37a32 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -3773,12 +3773,6 @@ mpt3sas_ctl_exit(ushort hbas_to_enumerate)
 		for (i = 0; i < MPI2_DIAG_BUF_TYPE_COUNT; i++) {
 			if (!ioc->diag_buffer[i])
 				continue;
-			if (!(ioc->diag_buffer_status[i] &
-			    MPT3_DIAG_BUFFER_IS_REGISTERED))
-				continue;
-			if ((ioc->diag_buffer_status[i] &
-			    MPT3_DIAG_BUFFER_IS_RELEASED))
-				continue;
 			dma_free_coherent(&ioc->pdev->dev,
 					  ioc->diag_buffer_sz[i],
 					  ioc->diag_buffer[i],
-- 
1.8.3.1


  parent reply	other threads:[~2019-09-13 13:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-13 13:04 [PATCH 00/13] Enhancements w.r.t to diag buffer and few bug fixes Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 01/13] mpt3sas: Register trace buffer based on NVDATA settings Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 02/13] mpt3sas: Display message before releasing diag buffer Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 03/13] mpt3sas: Fix clear pending bit in ioctl status Sreekanth Reddy
2019-09-13 13:04 ` Sreekanth Reddy [this message]
2019-09-13 13:04 ` [PATCH 05/13] mpt3sas: Maintain owner of buffer through UniqueID Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 06/13] mpt3sas: clear release bit when buffer reregistered Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 07/13] mpt3sas: Reuse diag buffer allocated at load time Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 08/13] mpt3sas: Add app owned flag support for diag buffer Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 09/13] mpt3sas: Fail release cmnd if diag buffer is released Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 10/13] mpt3sas: Use Component img header to get Package ver Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 11/13] mpt3sas: Reject NVMe Encap cmnds to unsupported HBA Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 12/13] mpt3sas: Fix module parameter max_msix_vectors Sreekanth Reddy
2019-09-13 13:04 ` [PATCH 13/13] mpt3sas: Bump mpt3sas driver version to 32.100.00.00 Sreekanth Reddy
2019-10-01  2:34 ` [PATCH 00/13] Enhancements w.r.t to diag buffer and few bug fixes Martin K. Petersen

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=1568379890-18347-5-git-send-email-sreekanth.reddy@broadcom.com \
    --to=sreekanth.reddy@broadcom.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=sathya.prakash@broadcom.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.