* Re: Bug: access to already released memory
[not found] ` <20100131035540.GA13428@linux-sh.org>
@ 2010-01-31 10:00 ` Marek Skuczynski
2010-02-01 21:27 ` Paul Walmsley
0 siblings, 1 reply; 3+ messages in thread
From: Marek Skuczynski @ 2010-01-31 10:00 UTC (permalink / raw)
To: linux-omap; +Cc: Paul Mundt
[-- Attachment #1: Type: text/plain, Size: 887 bytes --]
Hello,
I have found an access to already released memory in
clk_debugfs_register_one() function,
attaching a patch. The included patch was prepared for Linux 2.6 repository.
Regards,
Marek
On Sun, Jan 31, 2010 at 4:55 AM, Paul Mundt <lethal@linux-sh.org> wrote:
> On Sat, Jan 30, 2010 at 10:56:30PM +0100, Marek Skuczynski wrote:
>> I have found two places where access to already released memory happens,
>> attaching patches.
>>
> I'll apply them for 2.6.33, thanks.
>
>> 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(-)
>>
> Note that this code was copied from omap, so you may want to send them a
> patch for arch/arm/plat-omap/clock.c, too.
>
[-- Attachment #2: 0001-arm-omap-Fix-access-to-already-released-memory-in-cl.patch --]
[-- Type: text/x-patch, Size: 1124 bytes --]
From a1d2a9cf952a119049989bea6b453b3b09c98b4b Mon Sep 17 00:00:00 2001
From: Marek Skuczynski <mareksk7@gmail.com>
Date: Sun, 31 Jan 2010 10:35:15 +0100
Subject: [PATCH] arm/omap: Fix access to already released memory in clk_debugfs_register_one()
Signed-off-by: Marek Skuczynski <mareksk7@gmail.com>
---
arch/arm/plat-omap/clock.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index d9f8c84..4becbdd 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -391,7 +391,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;
@@ -423,7 +423,7 @@ static int clk_debugfs_register_one(struct clk *c)
err_out:
d = c->dent;
- 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->dent);
return err;
--
1.6.4.2
^ permalink raw reply related [flat|nested] 3+ messages in thread