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-Url: https://git.stricted.de/?a=commitdiff_plain;h=bc10e875d4aeaa93a0d418d8b4346b72f5067ea0;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.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 f3a46be2ae81..83da5debeedf 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;