diff mbox

Bug: access to already released memory

Message ID a328840c1001301356r14505614pbb4563754c6890ac@mail.gmail.com (mailing list archive)
State Accepted
Headers show

Commit Message

Marek Skuczynski Jan. 30, 2010, 9:56 p.m. UTC
None
diff mbox

Patch

From d24a9cf204199f1bfb9215f5841192a1833f5fd7 Mon Sep 17 00:00:00 2001
From: Marek Skuczynski <mareksk7@gmail.com>
Date: Sat, 30 Jan 2010 22:29:32 +0100
Subject: [PATCH 2/2] sh: Fix access to released memory in clk_debugfs_register_one()

Signed-off-by: Marek Skuczynski <mareksk7@gmail.com>
---
 arch/sh/kernel/cpu/clock.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
index f3a46be..83da5de 100644
--- a/arch/sh/kernel/cpu/clock.c
+++ b/arch/sh/kernel/cpu/clock.c
@@ -598,7 +598,7 @@  static struct dentry *clk_debugfs_root;
 static int clk_debugfs_register_one(struct clk *c)
 {
 	int err;
-	struct dentry *d, *child;
+	struct dentry *d, *child, *child_tmp;
 	struct clk *pa = c->parent;
 	char s[255];
 	char *p = s;
@@ -630,7 +630,7 @@  static int clk_debugfs_register_one(struct clk *c)
 
 err_out:
 	d = c->dentry;
-	list_for_each_entry(child, &d->d_subdirs, d_u.d_child)
+	list_for_each_entry_safe(child, child_tmp, &d->d_subdirs, d_u.d_child)
 		debugfs_remove(child);
 	debugfs_remove(c->dentry);
 	return err;
-- 
1.6.4.2