Skip to contentSkip to conversation

Patch "aacraid: Fix memory leak in aac_fib_map_free" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Apr 9, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

aacraid: Fix memory leak in aac_fib_map_free

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
aacraid-fix-memory-leak-in-aac_fib_map_free.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From f88fa79a61726ce9434df9b4aede36961f709f17 Mon Sep 17 00:00:00 2001

From: Raghava Aditya Renukunta <[email protected]>
Date: Wed, 3 Feb 2016 15:06:02 -0800
Subject: aacraid: Fix memory leak in aac_fib_map_free

From: Raghava Aditya Renukunta <[email protected]>

commit f88fa79a61726ce9434df9b4aede36961f709f17 upstream.

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.

Fixes 9ad5204d6 - "[SCSI]aacraid: incorrect dma mapping mask during blinked recover or user initiated reset"
---
 drivers/scsi/aacraid/commsup.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/scsi/aacraid/commsup.c +6 -3
@@ -83,9 +83,12 @@ static int fib_map_alloc(struct aac_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;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/aacraid-fix-memory-leak-in-aac_fib_map_free.patch queue-4.4/aacraid-fix-rrq-overload.patch queue-4.4/aacraid-set-correct-msix-count-for-eeh-recovery.patch