[patch 2.6.27.y 4/6] firewire: fix struct fw_node memory leak

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Stefan Richter
Date: Monday, October 27, 2008 - 3:28 pm

Date: Thu, 16 Oct 2008 18:00:15 -0400
From: Jay Fenlason <fenlason@redhat.com>

With the bus_resets patch applied, it is easy to see this memory leak
by repeatedly resetting the firewire bus while running slabtop in
another window.  Just watch kmalloc-32 grow and grow...

Same as commit 77e557191701afa55ae7320d42ad6458a2ad292e.

Signed-off-by: Jay Fenlason <fenlason@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/fw-topology.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Index: linux/drivers/firewire/fw-topology.c
===================================================================
--- linux.orig/drivers/firewire/fw-topology.c
+++ linux/drivers/firewire/fw-topology.c
@@ -413,7 +413,7 @@ static void
 update_tree(struct fw_card *card, struct fw_node *root)
 {
 	struct list_head list0, list1;
-	struct fw_node *node0, *node1;
+	struct fw_node *node0, *node1, *next1;
 	int i, event;
 
 	INIT_LIST_HEAD(&list0);
@@ -485,7 +485,9 @@ update_tree(struct fw_card *card, struct
 		}
 
 		node0 = fw_node(node0->link.next);
-		node1 = fw_node(node1->link.next);
+		next1 = fw_node(node1->link.next);
+		fw_node_put(node1);
+		node1 = next1;
 	}
 }
 

-- 
Stefan Richter
-=====-==--- =-=- ==-==
http://arcgraph.de/sr/

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2.6.27.y 2/6] firewire: fix ioctl() return code, Stefan Richter, (Mon Oct 27, 3:26 pm)
[patch 2.6.27.y 4/6] firewire: fix struct fw_node memory leak, Stefan Richter, (Mon Oct 27, 3:28 pm)
[patch 2.6.27.y 6/6] firewire: fw-sbp2: fix races, Stefan Richter, (Mon Oct 27, 3:29 pm)