* [PATCH] kobject_set_name: free old_name in case of ENOMEM
@ 2009-09-09 16:53 Sebastian Ott
2009-09-09 17:03 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Ott @ 2009-09-09 16:53 UTC (permalink / raw)
To: linux-kernel; +Cc: kay.sievers, gregkh
If the memory allocation for the kobject's name fails we should free
the old_name since it is no longer accessible via kobj->name.
Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
---
lib/kobject.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: git.linux-2.6/lib/kobject.c
===================================================================
--- git.linux-2.6.orig/lib/kobject.c 2009-06-17 10:35:55.000000000 +0200
+++ git.linux-2.6/lib/kobject.c 2009-09-09 18:21:39.000000000 +0200
@@ -222,8 +222,10 @@ int kobject_set_name_vargs(struct kobjec
return 0;
kobj->name = kvasprintf(GFP_KERNEL, fmt, vargs);
- if (!kobj->name)
+ if (!kobj->name) {
+ kfree(old_name);
return -ENOMEM;
+ }
/* ewww... some of these buggers have '/' in the name ... */
while ((s = strchr(kobj->name, '/')))
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] kobject_set_name: free old_name in case of ENOMEM
2009-09-09 16:53 [PATCH] kobject_set_name: free old_name in case of ENOMEM Sebastian Ott
@ 2009-09-09 17:03 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2009-09-09 17:03 UTC (permalink / raw)
To: Sebastian Ott; +Cc: linux-kernel, kay.sievers
On Wed, Sep 09, 2009 at 06:53:21PM +0200, Sebastian Ott wrote:
>
> If the memory allocation for the kobject's name fails we should free
> the old_name since it is no longer accessible via kobj->name.
Hasn't this come up a bunch in the past, and we do not want to do this?
You might want to search the lkml archives for details...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-09-09 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-09 16:53 [PATCH] kobject_set_name: free old_name in case of ENOMEM Sebastian Ott
2009-09-09 17:03 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox