From: Marek Skuczynski Date: Sat, 30 Jan 2010 21:29:32 +0000 (+0100) Subject: sh: Fix access to released memory in clk_debugfs_register_one() X-Git-Tag: upstream/snapshot3+hdmi~15742^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc10e875d4aeaa93a0d418d8b4346b72f5067ea0;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git sh: Fix access to released memory in clk_debugfs_register_one() Signed-off-by: Marek Skuczynski Signed-off-by: Paul Mundt --- 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;