public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@pmcs.com>
To: James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org
Cc: Mahesh.Rajashekhara@pmcs.com, Murthy.Bhat@pmcs.com,
	Gana.Sridaran@pmcs.com, aacraid@pmc-sierra.com,
	Scott.Benesh@pmcs.com, jthumshirn@suse.de, thenzl@redhat.com,
	shane.seymour@hpe.com, RaghavaAditya.Renukunta@pmcs.com
Subject: [PATCH V4 4/9] aacraid: Fix memory leak in aac_fib_map_free
Date: Fri, 29 Jan 2016 14:45:45 -0800	[thread overview]
Message-ID: <1454107550-24173-5-git-send-email-RaghavaAditya.Renukunta@pmcs.com> (raw)
In-Reply-To: <1454107550-24173-1-git-send-email-RaghavaAditya.Renukunta@pmcs.com>

From: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>

aac_fib_map_free() calls pci_free_consistent() without checking that
dev->hw_fib_va is not NULL and dev->max_fib_size is not zero.If they
are indeed NULL/0, this will result in a hang as pci_free_consistent()
will attempt to invalidate cache for the entire 64-bit address space
(which would take a very long time).

Fixed by adding a check to make sure that dev->hw_fib_va and
dev->max_fib_size are not NULL and 0 respectively.

Changes in V2:
None

Changes in V3:
None

Changes in V4:
None

Fixes: 9ad5204d6 - "[SCSI]aacraid: incorrect dma mapping mask
during blinked recover or user initiated reset"
Cc: stable@vger.kernel.org

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/aacraid/commsup.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 07a42a3..511bbc5 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_dev *dev)
 
 void aac_fib_map_free(struct aac_dev *dev)
 {
-	pci_free_consistent(dev->pdev,
-	  dev->max_fib_size * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB),
-	  dev->hw_fib_va, dev->hw_fib_pa);
+	if (dev->hw_fib_va && dev->max_fib_size) {
+		pci_free_consistent(dev->pdev,
+		(dev->max_fib_size *
+		(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)),
+		dev->hw_fib_va, dev->hw_fib_pa);
+	}
 	dev->hw_fib_va = NULL;
 	dev->hw_fib_pa = 0;
 }
-- 
1.9.1


  parent reply	other threads:[~2016-01-29 22:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 22:45 [PATCH V4 0/9] aacraid: Patchset for aacraid driver version 41052 Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 1/9] aacraid: SCSI blk tag support Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 2/9] aacraid: Fix RRQ overload Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 3/9] aacraid: Added EEH support Raghava Aditya Renukunta
2016-01-30 22:52   ` kbuild test robot
2016-01-29 22:45 ` Raghava Aditya Renukunta [this message]
2016-01-29 22:45 ` [PATCH V4 5/9] aacraid: Set correct msix count for EEH recovery Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 6/9] aacraid: Fundamental reset support for Series 7 Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 7/9] aacraid: Fix AIF triggered IOP_RESET Raghava Aditya Renukunta
2016-02-01 16:43   ` Tomas Henzl
2016-02-02  1:18     ` Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 8/9] aacraid: Fix character device re-initialization Raghava Aditya Renukunta
2016-01-29 22:45 ` [PATCH V4 9/9] aacraid: Update driver version Raghava Aditya Renukunta
2016-02-02  0:56 ` [PATCH V4 0/9] aacraid: Patchset for aacraid driver version 41052 Martin K. Petersen
2016-02-02  1:19   ` Raghava Aditya Renukunta

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=1454107550-24173-5-git-send-email-RaghavaAditya.Renukunta@pmcs.com \
    --to=raghavaaditya.renukunta@pmcs.com \
    --cc=Gana.Sridaran@pmcs.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=Mahesh.Rajashekhara@pmcs.com \
    --cc=Murthy.Bhat@pmcs.com \
    --cc=Scott.Benesh@pmcs.com \
    --cc=aacraid@pmc-sierra.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=shane.seymour@hpe.com \
    --cc=thenzl@redhat.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