* [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c
@ 2010-04-21 11:09 GuanJun He
2010-04-21 16:27 ` Américo Wang
0 siblings, 1 reply; 4+ messages in thread
From: GuanJun He @ 2010-04-21 11:09 UTC (permalink / raw)
To: linux-kernel
fix badness in fs/proc/generic.c, Bug 15589 - 2.6.34-rc1: Badness at
fs/proc/generic.c:316
Signed-off-by: Guanjun He <heguanbo@gmail.com>
---
diff -Nupr linux-2.6.34-rc1.orig/fs/proc/generic.c
linux-2.6.34-rc1/fs/proc/generic.c
--- linux-2.6.34-rc1.orig/fs/proc/generic.c 2010-03-09
02:45:44.000000000 +0800
+++ linux-2.6.34-rc1/fs/proc/generic.c 2010-04-21 19:02:49.000000000 +0800
@@ -297,11 +297,13 @@ static int __xlate_proc_name(const char
const char *cp = name, *next;
struct proc_dir_entry *de;
int len;
+ int rtn = 0;
de = *ret;
if (!de)
de = &proc_root;
+ spin_lock(&proc_subdir_lock);
while (1) {
next = strchr(cp, '/');
if (!next)
@@ -313,14 +315,17 @@ static int __xlate_proc_name(const char
break;
}
if (!de) {
- WARN(1, "name '%s'\n", name);
- return -ENOENT;
+ WARN(1, "name \"%s\"\n", name);
+ rtn = -ENOENT;
+ goto out;
}
cp += len + 1;
}
*residual = cp;
*ret = de;
- return 0;
+out:
+ spin_unlock(&proc_subdir_lock);
+ return rtn;
}
static int xlate_proc_name(const char *name, struct proc_dir_entry **ret,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c
2010-04-21 11:09 [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c GuanJun He
@ 2010-04-21 16:27 ` Américo Wang
0 siblings, 0 replies; 4+ messages in thread
From: Américo Wang @ 2010-04-21 16:27 UTC (permalink / raw)
To: GuanJun He; +Cc: linux-kernel
On Wed, Apr 21, 2010 at 07:09:42PM +0800, GuanJun He wrote:
>fix badness in fs/proc/generic.c, Bug 15589 - 2.6.34-rc1: Badness at
>fs/proc/generic.c:316
>
>Signed-off-by: Guanjun He <heguanbo@gmail.com>
NACK.
The callers of __xlate_proc_name() all hold proc_subdir_lock.
>
>---
>diff -Nupr linux-2.6.34-rc1.orig/fs/proc/generic.c
>linux-2.6.34-rc1/fs/proc/generic.c
>--- linux-2.6.34-rc1.orig/fs/proc/generic.c 2010-03-09
>02:45:44.000000000 +0800
>+++ linux-2.6.34-rc1/fs/proc/generic.c 2010-04-21 19:02:49.000000000 +0800
>@@ -297,11 +297,13 @@ static int __xlate_proc_name(const char
> const char *cp = name, *next;
> struct proc_dir_entry *de;
> int len;
>+ int rtn = 0;
>
> de = *ret;
> if (!de)
> de = &proc_root;
>
>+ spin_lock(&proc_subdir_lock);
> while (1) {
> next = strchr(cp, '/');
> if (!next)
>@@ -313,14 +315,17 @@ static int __xlate_proc_name(const char
> break;
> }
> if (!de) {
>- WARN(1, "name '%s'\n", name);
>- return -ENOENT;
>+ WARN(1, "name \"%s\"\n", name);
>+ rtn = -ENOENT;
>+ goto out;
> }
> cp += len + 1;
> }
> *residual = cp;
> *ret = de;
>- return 0;
>+out:
>+ spin_unlock(&proc_subdir_lock);
>+ return rtn;
> }
>
> static int xlate_proc_name(const char *name, struct proc_dir_entry **ret,
>--
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at http://www.tux.org/lkml/
--
Live like a child, think like the god.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c
2010-04-22 4:10 GuanJun He
@ 2010-04-22 6:09 ` Alexey Dobriyan
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Dobriyan @ 2010-04-22 6:09 UTC (permalink / raw)
To: GuanJun He; +Cc: linux-kernel
On Thu, Apr 22, 2010 at 7:10 AM, GuanJun He <heguanbo@gmail.com> wrote:
> fix badness in fs/proc/generic.c, Bug 15589 - 2.6.34-rc1: Badness at
> fs/proc/generic.c:316
> this is just to get least waste.
This is already fixed by powerpc folks, I believe.
Without memory leak.
> --- linux-2.6.34-rc1.orig/fs/proc/generic.c
> +++ linux-2.6.34-rc1/fs/proc/generic.c
> @@ -313,7 +313,15 @@ static int __xlate_proc_name(const char
> break;
> }
> if (!de) {
> - WARN(1, "name '%s'\n", name);
> + char *dup = kstrdup(name, GFP_KERNEL);
> + if (dup) {
> + cp = dup;
> + while(*dup) {
> + if (*dup == '/')
> + *dup++ = '_';
> + }
> + WARN(1, "name '%s'\n", cp);
> + }
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c
@ 2010-04-22 4:10 GuanJun He
2010-04-22 6:09 ` Alexey Dobriyan
0 siblings, 1 reply; 4+ messages in thread
From: GuanJun He @ 2010-04-22 4:10 UTC (permalink / raw)
To: linux-kernel
fix badness in fs/proc/generic.c, Bug 15589 - 2.6.34-rc1: Badness at
fs/proc/generic.c:316
this is just to get least waste.
Signed-off-by: Guanjun He <heguanbo@gmail.com>
---
diff -Nupr linux-2.6.34-rc1.orig/fs/proc/generic.c
linux-2.6.34-rc1/fs/proc/generic.c
--- linux-2.6.34-rc1.orig/fs/proc/generic.c 2010-03-09
02:45:44.000000000 +0800
+++ linux-2.6.34-rc1/fs/proc/generic.c 2010-04-22 11:32:00.000000000 +0800
@@ -313,7 +313,15 @@ static int __xlate_proc_name(const char
break;
}
if (!de) {
- WARN(1, "name '%s'\n", name);
+ char *dup = kstrdup(name, GFP_KERNEL);
+ if (dup) {
+ cp = dup;
+ while(*dup) {
+ if (*dup == '/')
+ *dup++ = '_';
+ }
+ WARN(1, "name '%s'\n", cp);
+ }
return -ENOENT;
}
cp += len + 1;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-22 6:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-21 11:09 [PATCH 2.6.34-rc1] proc: fix badness in fs/proc/generic.c GuanJun He
2010-04-21 16:27 ` Américo Wang
2010-04-22 4:10 GuanJun He
2010-04-22 6:09 ` Alexey Dobriyan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.