public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
@ 2013-12-09  9:37 Ethan Zhao
  2013-12-09 21:30 ` Konrad Rzeszutek Wilk
  2013-12-10  0:16 ` Mike Christie
  0 siblings, 2 replies; 9+ messages in thread
From: Ethan Zhao @ 2013-12-09  9:37 UTC (permalink / raw)
  To: konrad.wilk, michaelc, pjones; +Cc: linux-kernel, Ethan Zhao

From: "Ethan Zhao" <ethan.kernel@gmail.com>

Load and unload iscsi_ibft module will cause kernel memory leak, fix it
in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().

Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
---
 drivers/scsi/iscsi_boot_sysfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
index 14c1c8f..680bf6f 100644
--- a/drivers/scsi/iscsi_boot_sysfs.c
+++ b/drivers/scsi/iscsi_boot_sysfs.c
@@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset)
 		iscsi_boot_remove_kobj(boot_kobj);
 
 	kset_unregister(boot_kset->kset);
+	kfree(boot_kset);
 }
 EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
-- 
1.8.3.4 (Apple Git-47)


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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-09  9:37 [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset() Ethan Zhao
@ 2013-12-09 21:30 ` Konrad Rzeszutek Wilk
  2013-12-10  6:03   ` Ethan Zhao
  2013-12-10  0:16 ` Mike Christie
  1 sibling, 1 reply; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-12-09 21:30 UTC (permalink / raw)
  To: Ethan Zhao; +Cc: michaelc, pjones, linux-kernel

On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
> From: "Ethan Zhao" <ethan.kernel@gmail.com>
> 
> Load and unload iscsi_ibft module will cause kernel memory leak, fix it
> in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
> 

Is there a stack trace?
> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
> ---
>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
> index 14c1c8f..680bf6f 100644
> --- a/drivers/scsi/iscsi_boot_sysfs.c
> +++ b/drivers/scsi/iscsi_boot_sysfs.c
> @@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset)
>  		iscsi_boot_remove_kobj(boot_kobj);
>  
>  	kset_unregister(boot_kset->kset);
> +	kfree(boot_kset);
>  }
>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
> -- 
> 1.8.3.4 (Apple Git-47)
> 

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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-09  9:37 [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset() Ethan Zhao
  2013-12-09 21:30 ` Konrad Rzeszutek Wilk
@ 2013-12-10  0:16 ` Mike Christie
  1 sibling, 0 replies; 9+ messages in thread
From: Mike Christie @ 2013-12-10  0:16 UTC (permalink / raw)
  To: Ethan Zhao; +Cc: konrad.wilk, pjones, linux-kernel

On 12/09/2013 03:37 AM, Ethan Zhao wrote:
> From: "Ethan Zhao" <ethan.kernel@gmail.com>
> 
> Load and unload iscsi_ibft module will cause kernel memory leak, fix it
> in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
> 
> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
> ---
>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
> index 14c1c8f..680bf6f 100644
> --- a/drivers/scsi/iscsi_boot_sysfs.c
> +++ b/drivers/scsi/iscsi_boot_sysfs.c
> @@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset)
>  		iscsi_boot_remove_kobj(boot_kobj);
>  
>  	kset_unregister(boot_kset->kset);
> +	kfree(boot_kset);
>  }
>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);

Thanks. Patch looks ok.

It is probably best to just kill the iscsi_boot_kset use and use the
kset directly. To do that, we would need to make kset's list a klist and
add some iterators then modify iscsi_boot_sysfs.c and iscsi_ibft.c to
use them instead of using the iscsi_boot_kset->kobj_list. I will work on
a patch to do this. But for now your patch is ok.

Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>


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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-09 21:30 ` Konrad Rzeszutek Wilk
@ 2013-12-10  6:03   ` Ethan Zhao
  2013-12-10 14:11     ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 9+ messages in thread
From: Ethan Zhao @ 2013-12-10  6:03 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: michaelc, pjones, LKML

Konrad,

 boot_kset was allocated when module loaded by
ibft_init()
  iscsi_boot_create_kset()
     kzalloc()

but wasn't freed when module unloaded by
ibft_exit()
   ibft_cleanup()
     iscsi_boot_destroy_kset()

Thanks,
Ethan

On Tue, Dec 10, 2013 at 5:30 AM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
>> From: "Ethan Zhao" <ethan.kernel@gmail.com>
>>
>> Load and unload iscsi_ibft module will cause kernel memory leak, fix it
>> in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
>>
>
> Is there a stack trace?
>> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
>> ---
>>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
>> index 14c1c8f..680bf6f 100644
>> --- a/drivers/scsi/iscsi_boot_sysfs.c
>> +++ b/drivers/scsi/iscsi_boot_sysfs.c
>> @@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct iscsi_boot_kset *boot_kset)
>>               iscsi_boot_remove_kobj(boot_kobj);
>>
>>       kset_unregister(boot_kset->kset);
>> +     kfree(boot_kset);
>>  }
>>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
>> --
>> 1.8.3.4 (Apple Git-47)
>>

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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-10  6:03   ` Ethan Zhao
@ 2013-12-10 14:11     ` Konrad Rzeszutek Wilk
  2013-12-10 18:46       ` Mike Christie
  2013-12-11  2:47       ` Ethan Zhao
  0 siblings, 2 replies; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-12-10 14:11 UTC (permalink / raw)
  To: Ethan Zhao; +Cc: michaelc, pjones, LKML

Ethan Zhao <ethan.kernel@gmail.com> wrote:
>Konrad,
>
> boot_kset was allocated when module loaded by
>ibft_init()
>  iscsi_boot_create_kset()
>     kzalloc()
>
>but wasn't freed when module unloaded by
>ibft_exit()
>   ibft_cleanup()
>     iscsi_boot_destroy_kset()
>
>Thanks,
>Ethan
>
>On Tue, Dec 10, 2013 at 5:30 AM, Konrad Rzeszutek Wilk
><konrad.wilk@oracle.com> wrote:
>> On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
>>> From: "Ethan Zhao" <ethan.kernel@gmail.com>
>>>
>>> Load and unload iscsi_ibft module will cause kernel memory leak, fix
>it
>>> in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
>>>
>>
>> Is there a stack trace?
>>> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
>>> ---
>>>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/scsi/iscsi_boot_sysfs.c
>b/drivers/scsi/iscsi_boot_sysfs.c
>>> index 14c1c8f..680bf6f 100644
>>> --- a/drivers/scsi/iscsi_boot_sysfs.c
>>> +++ b/drivers/scsi/iscsi_boot_sysfs.c
>>> @@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct
>iscsi_boot_kset *boot_kset)
>>>               iscsi_boot_remove_kobj(boot_kobj);
>>>
>>>       kset_unregister(boot_kset->kset);
>>> +     kfree(boot_kset);
>>>  }
>>>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
>>> --
>>> 1.8.3.4 (Apple Git-47)
>>>

Right. In the past we did not do that b/c certain drivers (like broadcom) would allocate on the kset their name and try to free (the driver would after freeing the ibft). So you would end up with this patch a double free ( and it might be fixed by now but I can't recall).

My question was - did you observer a crash or bug. Hence the question about stack trace? How did you see this?

Thank you.


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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-10 14:11     ` Konrad Rzeszutek Wilk
@ 2013-12-10 18:46       ` Mike Christie
  2013-12-11 17:18         ` Konrad Rzeszutek Wilk
  2013-12-11  2:47       ` Ethan Zhao
  1 sibling, 1 reply; 9+ messages in thread
From: Mike Christie @ 2013-12-10 18:46 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: Ethan Zhao, pjones, LKML

On 12/10/13 8:11 AM, Konrad Rzeszutek Wilk wrote:
> Ethan Zhao <ethan.kernel@gmail.com> wrote:
>> Konrad,
>>
>> boot_kset was allocated when module loaded by
>> ibft_init()
>>   iscsi_boot_create_kset()
>>      kzalloc()
>>
>> but wasn't freed when module unloaded by
>> ibft_exit()
>>    ibft_cleanup()
>>      iscsi_boot_destroy_kset()
>>
>> Thanks,
>> Ethan
>>
>> On Tue, Dec 10, 2013 at 5:30 AM, Konrad Rzeszutek Wilk
>> <konrad.wilk@oracle.com> wrote:
>>> On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
>>>> From: "Ethan Zhao" <ethan.kernel@gmail.com>
>>>>
>>>> Load and unload iscsi_ibft module will cause kernel memory leak, fix
>> it
>>>> in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
>>>>
>>>
>>> Is there a stack trace?
>>>> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
>>>> ---
>>>>   drivers/scsi/iscsi_boot_sysfs.c | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/scsi/iscsi_boot_sysfs.c
>> b/drivers/scsi/iscsi_boot_sysfs.c
>>>> index 14c1c8f..680bf6f 100644
>>>> --- a/drivers/scsi/iscsi_boot_sysfs.c
>>>> +++ b/drivers/scsi/iscsi_boot_sysfs.c
>>>> @@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct
>> iscsi_boot_kset *boot_kset)
>>>>                iscsi_boot_remove_kobj(boot_kobj);
>>>>
>>>>        kset_unregister(boot_kset->kset);
>>>> +     kfree(boot_kset);
>>>>   }
>>>>   EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
>>>> --
>>>> 1.8.3.4 (Apple Git-47)
>>>>
>
> Right. In the past we did not do that b/c certain drivers (like broadcom) would allocate on the kset their name and try to free (the driver would after freeing the ibft). So you would end up with this patch a double free ( and it might be fixed by now but I can't recall).
>

Do you mean the name string that is passed into kset_create_and_add? If 
so that should not happen now. There does not seem to be any user 
freeing that string.

There used to be bug where at the initiator/target/ethernet level there 
was a double free because iscsi_boot_sysfs and be2iscsi were both 
freeing the struct associated with the initiator/target/ethernet. That 
is fixed in f457a46f179df41b0f6d80dee33b6e629945f276.



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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-10 14:11     ` Konrad Rzeszutek Wilk
  2013-12-10 18:46       ` Mike Christie
@ 2013-12-11  2:47       ` Ethan Zhao
  1 sibling, 0 replies; 9+ messages in thread
From: Ethan Zhao @ 2013-12-11  2:47 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: michaelc, pjones, LKML

On Tue, Dec 10, 2013 at 10:11 PM, Konrad Rzeszutek Wilk
<konrad.wilk@oracle.com> wrote:
> Ethan Zhao <ethan.kernel@gmail.com> wrote:
>>Konrad,
>>
>> boot_kset was allocated when module loaded by
>>ibft_init()
>>  iscsi_boot_create_kset()
>>     kzalloc()
>>
>>but wasn't freed when module unloaded by
>>ibft_exit()
>>   ibft_cleanup()
>>     iscsi_boot_destroy_kset()
>>
>>Thanks,
>>Ethan
>>
>>On Tue, Dec 10, 2013 at 5:30 AM, Konrad Rzeszutek Wilk
>><konrad.wilk@oracle.com> wrote:
>>> On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
>>>> From: "Ethan Zhao" <ethan.kernel@gmail.com>
>>>>
>>>> Load and unload iscsi_ibft module will cause kernel memory leak, fix
>>it
>>>> in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
>>>>
>>>
>>> Is there a stack trace?
>>>> Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
>>>> ---
>>>>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
>>>>  1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/drivers/scsi/iscsi_boot_sysfs.c
>>b/drivers/scsi/iscsi_boot_sysfs.c
>>>> index 14c1c8f..680bf6f 100644
>>>> --- a/drivers/scsi/iscsi_boot_sysfs.c
>>>> +++ b/drivers/scsi/iscsi_boot_sysfs.c
>>>> @@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct
>>iscsi_boot_kset *boot_kset)
>>>>               iscsi_boot_remove_kobj(boot_kobj);
>>>>
>>>>       kset_unregister(boot_kset->kset);
>>>> +     kfree(boot_kset);
>>>>  }
>>>>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
>>>> --
>>>> 1.8.3.4 (Apple Git-47)
>>>>
>
> Right. In the past we did not do that b/c certain drivers (like broadcom) would allocate on the kset their name and try to free (the driver would after freeing the ibft). So you would end up with this patch a double free ( and it might be fixed by now but I can't recall).
>
> My question was - did you observer a crash or bug. Hence the question about stack trace? How did you see this?

That is quite simple, just like fuzzy test, load and unload a module
millions of times with a script in low memory size machine, in the
meanwhile, monitor OOM etc.

Thanks,
Ethan

>
> Thank you.
>

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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-10 18:46       ` Mike Christie
@ 2013-12-11 17:18         ` Konrad Rzeszutek Wilk
  2013-12-11 17:19           ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-12-11 17:18 UTC (permalink / raw)
  To: Mike Christie; +Cc: Ethan Zhao, pjones, LKML

On Tue, Dec 10, 2013 at 12:46:36PM -0600, Mike Christie wrote:
> On 12/10/13 8:11 AM, Konrad Rzeszutek Wilk wrote:
> >Ethan Zhao <ethan.kernel@gmail.com> wrote:
> >>Konrad,
> >>
> >>boot_kset was allocated when module loaded by
> >>ibft_init()
> >>  iscsi_boot_create_kset()
> >>     kzalloc()
> >>
> >>but wasn't freed when module unloaded by
> >>ibft_exit()
> >>   ibft_cleanup()
> >>     iscsi_boot_destroy_kset()
> >>
> >>Thanks,
> >>Ethan
> >>
> >>On Tue, Dec 10, 2013 at 5:30 AM, Konrad Rzeszutek Wilk
> >><konrad.wilk@oracle.com> wrote:
> >>>On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
> >>>>From: "Ethan Zhao" <ethan.kernel@gmail.com>
> >>>>
> >>>>Load and unload iscsi_ibft module will cause kernel memory leak, fix
> >>it
> >>>>in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
> >>>>
> >>>
> >>>Is there a stack trace?
> >>>>Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
> >>>>---
> >>>>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
> >>>>  1 file changed, 1 insertion(+)
> >>>>
> >>>>diff --git a/drivers/scsi/iscsi_boot_sysfs.c
> >>b/drivers/scsi/iscsi_boot_sysfs.c
> >>>>index 14c1c8f..680bf6f 100644
> >>>>--- a/drivers/scsi/iscsi_boot_sysfs.c
> >>>>+++ b/drivers/scsi/iscsi_boot_sysfs.c
> >>>>@@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct
> >>iscsi_boot_kset *boot_kset)
> >>>>               iscsi_boot_remove_kobj(boot_kobj);
> >>>>
> >>>>       kset_unregister(boot_kset->kset);
> >>>>+     kfree(boot_kset);
> >>>>  }
> >>>>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
> >>>>--
> >>>>1.8.3.4 (Apple Git-47)
> >>>>
> >
> >Right. In the past we did not do that b/c certain drivers (like broadcom) would allocate on the kset their name and try to free (the driver would after freeing the ibft). So you would end up with this patch a double free ( and it might be fixed by now but I can't recall).
> >
> 
> Do you mean the name string that is passed into kset_create_and_add?

Yes.
> If so that should not happen now. There does not seem to be any user
> freeing that string.
> 
> There used to be bug where at the initiator/target/ethernet level
> there was a double free because iscsi_boot_sysfs and be2iscsi were
> both freeing the struct associated with the
> initiator/target/ethernet. That is fixed in
> f457a46f179df41b0f6d80dee33b6e629945f276.

That is the one!
> 
> 

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

* Re: [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset()
  2013-12-11 17:18         ` Konrad Rzeszutek Wilk
@ 2013-12-11 17:19           ` Konrad Rzeszutek Wilk
  0 siblings, 0 replies; 9+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-12-11 17:19 UTC (permalink / raw)
  To: Mike Christie; +Cc: Ethan Zhao, pjones, LKML

On Wed, Dec 11, 2013 at 12:18:19PM -0500, Konrad Rzeszutek Wilk wrote:
> On Tue, Dec 10, 2013 at 12:46:36PM -0600, Mike Christie wrote:
> > On 12/10/13 8:11 AM, Konrad Rzeszutek Wilk wrote:
> > >Ethan Zhao <ethan.kernel@gmail.com> wrote:
> > >>Konrad,
> > >>
> > >>boot_kset was allocated when module loaded by
> > >>ibft_init()
> > >>  iscsi_boot_create_kset()
> > >>     kzalloc()
> > >>
> > >>but wasn't freed when module unloaded by
> > >>ibft_exit()
> > >>   ibft_cleanup()
> > >>     iscsi_boot_destroy_kset()
> > >>
> > >>Thanks,
> > >>Ethan
> > >>
> > >>On Tue, Dec 10, 2013 at 5:30 AM, Konrad Rzeszutek Wilk
> > >><konrad.wilk@oracle.com> wrote:
> > >>>On Mon, Dec 09, 2013 at 05:37:11PM +0800, Ethan Zhao wrote:
> > >>>>From: "Ethan Zhao" <ethan.kernel@gmail.com>
> > >>>>
> > >>>>Load and unload iscsi_ibft module will cause kernel memory leak, fix
> > >>it
> > >>>>in scsi/iscsi_boot_sysfs.c iscsi_boot_destroy_kset().
> > >>>>
> > >>>
> > >>>Is there a stack trace?
> > >>>>Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
> > >>>>---
> > >>>>  drivers/scsi/iscsi_boot_sysfs.c | 1 +
> > >>>>  1 file changed, 1 insertion(+)
> > >>>>
> > >>>>diff --git a/drivers/scsi/iscsi_boot_sysfs.c
> > >>b/drivers/scsi/iscsi_boot_sysfs.c
> > >>>>index 14c1c8f..680bf6f 100644
> > >>>>--- a/drivers/scsi/iscsi_boot_sysfs.c
> > >>>>+++ b/drivers/scsi/iscsi_boot_sysfs.c
> > >>>>@@ -490,5 +490,6 @@ void iscsi_boot_destroy_kset(struct
> > >>iscsi_boot_kset *boot_kset)
> > >>>>               iscsi_boot_remove_kobj(boot_kobj);
> > >>>>
> > >>>>       kset_unregister(boot_kset->kset);
> > >>>>+     kfree(boot_kset);
> > >>>>  }
> > >>>>  EXPORT_SYMBOL_GPL(iscsi_boot_destroy_kset);
> > >>>>--
> > >>>>1.8.3.4 (Apple Git-47)
> > >>>>
> > >
> > >Right. In the past we did not do that b/c certain drivers (like broadcom) would allocate on the kset their name and try to free (the driver would after freeing the ibft). So you would end up with this patch a double free ( and it might be fixed by now but I can't recall).
> > >
> > 
> > Do you mean the name string that is passed into kset_create_and_add?
> 
> Yes.
> > If so that should not happen now. There does not seem to be any user
> > freeing that string.
> > 
> > There used to be bug where at the initiator/target/ethernet level
> > there was a double free because iscsi_boot_sysfs and be2iscsi were
> > both freeing the struct associated with the
> > initiator/target/ethernet. That is fixed in
> > f457a46f179df41b0f6d80dee33b6e629945f276.
> 
> That is the one!

With that in mind, do you want to carry this patch to Linus (or James) or should I do it?
> > 
> > 

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

end of thread, other threads:[~2013-12-11 17:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-09  9:37 [PATCH] [SCSI] iscsi_boot_sysfs: Fix a memory leak in iscsi_boot_destroy_kset() Ethan Zhao
2013-12-09 21:30 ` Konrad Rzeszutek Wilk
2013-12-10  6:03   ` Ethan Zhao
2013-12-10 14:11     ` Konrad Rzeszutek Wilk
2013-12-10 18:46       ` Mike Christie
2013-12-11 17:18         ` Konrad Rzeszutek Wilk
2013-12-11 17:19           ` Konrad Rzeszutek Wilk
2013-12-11  2:47       ` Ethan Zhao
2013-12-10  0:16 ` Mike Christie

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