public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix possible kobject reference counter leak in kobject_rename()
@ 2008-08-21 10:31 Kenji Kaneshige
  2008-08-21 15:58 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Kenji Kaneshige @ 2008-08-21 10:31 UTC (permalink / raw)
  To: Greg KH, Linux Kernel Mailing List

Hi,

I found a possible kobject reference counter leak problem in
kobject_rename(). The following patch will fix it.

Thanks,
Kenji Kaneshige


Fix possible kobject reference counter leak in kobject_rename().

If kobject_rename() failed because of name collision, we must call
kobject_put() for specified kobject before return.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
 lib/kobject.c |    1 +
 1 file changed, 1 insertion(+)

Index: linux-2.6.27-rc4/lib/kobject.c
===================================================================
--- linux-2.6.27-rc4.orig/lib/kobject.c
+++ linux-2.6.27-rc4/lib/kobject.c
@@ -411,6 +411,7 @@ int kobject_rename(struct kobject *kobj,
 			       "to '%s' as '%s' is already in existence.\n",
 			       kobject_name(kobj), new_name, new_name);
 			kobject_put(temp_kobj);
+			kobject_put(kobj);
 			return -EINVAL;
 		}
 	}


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix possible kobject reference counter leak in kobject_rename()
  2008-08-21 10:31 [PATCH] Fix possible kobject reference counter leak in kobject_rename() Kenji Kaneshige
@ 2008-08-21 15:58 ` Greg KH
  2008-08-22  2:31   ` Kenji Kaneshige
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2008-08-21 15:58 UTC (permalink / raw)
  To: Kenji Kaneshige; +Cc: Linux Kernel Mailing List

On Thu, Aug 21, 2008 at 07:31:48PM +0900, Kenji Kaneshige wrote:
> Hi,
> 
> I found a possible kobject reference counter leak problem in
> kobject_rename(). The following patch will fix it.
> 
> Thanks,
> Kenji Kaneshige
> 
> 
> Fix possible kobject reference counter leak in kobject_rename().
> 
> If kobject_rename() failed because of name collision, we must call
> kobject_put() for specified kobject before return.
> 
> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
> 
> ---
>  lib/kobject.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: linux-2.6.27-rc4/lib/kobject.c
> ===================================================================
> --- linux-2.6.27-rc4.orig/lib/kobject.c
> +++ linux-2.6.27-rc4/lib/kobject.c
> @@ -411,6 +411,7 @@ int kobject_rename(struct kobject *kobj,
>  			       "to '%s' as '%s' is already in existence.\n",
>  			       kobject_name(kobj), new_name, new_name);
>  			kobject_put(temp_kobj);
> +			kobject_put(kobj);
>  			return -EINVAL;
>  		}
>  	}

Thanks, but this is already fixed up with a patch from Eric in my tree
in a different way.

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Fix possible kobject reference counter leak in kobject_rename()
  2008-08-21 15:58 ` Greg KH
@ 2008-08-22  2:31   ` Kenji Kaneshige
  0 siblings, 0 replies; 3+ messages in thread
From: Kenji Kaneshige @ 2008-08-22  2:31 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel Mailing List

Greg KH wrote:
> On Thu, Aug 21, 2008 at 07:31:48PM +0900, Kenji Kaneshige wrote:
>> Hi,
>>
>> I found a possible kobject reference counter leak problem in
>> kobject_rename(). The following patch will fix it.
>>
>> Thanks,
>> Kenji Kaneshige
>>
>>
>> Fix possible kobject reference counter leak in kobject_rename().
>>
>> If kobject_rename() failed because of name collision, we must call
>> kobject_put() for specified kobject before return.
>>
>> Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
>>
>> ---
>>  lib/kobject.c |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> Index: linux-2.6.27-rc4/lib/kobject.c
>> ===================================================================
>> --- linux-2.6.27-rc4.orig/lib/kobject.c
>> +++ linux-2.6.27-rc4/lib/kobject.c
>> @@ -411,6 +411,7 @@ int kobject_rename(struct kobject *kobj,
>>  			       "to '%s' as '%s' is already in existence.\n",
>>  			       kobject_name(kobj), new_name, new_name);
>>  			kobject_put(temp_kobj);
>> +			kobject_put(kobj);
>>  			return -EINVAL;
>>  		}
>>  	}
> 
> Thanks, but this is already fixed up with a patch from Eric in my tree
> in a different way.
> 
> greg k-h
> 
> 

Ah, I see. I didn't notice that. Thank you for the information.

Thanks,
Kenji Kaneshige



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-22  2:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-21 10:31 [PATCH] Fix possible kobject reference counter leak in kobject_rename() Kenji Kaneshige
2008-08-21 15:58 ` Greg KH
2008-08-22  2:31   ` Kenji Kaneshige

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox