public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] sg: fix memory leak
       [not found] <1380119219-13486-1-git-send-email-vegard.nossum@oracle.com>
@ 2013-09-26  2:05 ` vaughan
  2013-09-26  4:31   ` Douglas Gilbert
  0 siblings, 1 reply; 2+ messages in thread
From: vaughan @ 2013-09-26  2:05 UTC (permalink / raw)
  To: Vegard Nossum; +Cc: James Bottomley, linux-kernel, stable, Douglas Gilbert

On 09/25/2013 10:26 PM, Vegard Nossum wrote:
> Commit e32c9e6300e3af659cbfe45e90a1e7dcd3572ada introduced a memory
> leak. Fix it.
>
> Cc: stable@vger.kernel.org
> Cc: Vaughan Cao <vaughan.cao@oracle.com>
> Cc: Douglas Gilbert <dgilbert@interlog.com>
> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
> ---
>  drivers/scsi/sg.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
> index 5cbc4bb..a97143f 100644
> --- a/drivers/scsi/sg.c
> +++ b/drivers/scsi/sg.c
> @@ -2060,6 +2060,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
>  	spin_lock_irqsave(&sdp->sfd_lock, iflags);
>  	if (sdp->detached) {
>  		spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
> +		kfree(sfp);
>  		return ERR_PTR(-ENODEV);
>  	}
>  	list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
You're right. It's a memory leak.

Vaughan

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

* Re: [PATCH] sg: fix memory leak
  2013-09-26  2:05 ` [PATCH] sg: fix memory leak vaughan
@ 2013-09-26  4:31   ` Douglas Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Douglas Gilbert @ 2013-09-26  4:31 UTC (permalink / raw)
  To: vaughan, Vegard Nossum; +Cc: James Bottomley, linux-kernel, stable

On 13-09-25 10:05 PM, vaughan wrote:
> On 09/25/2013 10:26 PM, Vegard Nossum wrote:
>> Commit e32c9e6300e3af659cbfe45e90a1e7dcd3572ada introduced a memory
>> leak. Fix it.
>>
>> Cc: stable@vger.kernel.org
>> Cc: Vaughan Cao <vaughan.cao@oracle.com>
>> Cc: Douglas Gilbert <dgilbert@interlog.com>
>> Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
>> ---
>>   drivers/scsi/sg.c |    1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
>> index 5cbc4bb..a97143f 100644
>> --- a/drivers/scsi/sg.c
>> +++ b/drivers/scsi/sg.c
>> @@ -2060,6 +2060,7 @@ sg_add_sfp(Sg_device * sdp, int dev)
>>   	spin_lock_irqsave(&sdp->sfd_lock, iflags);
>>   	if (sdp->detached) {
>>   		spin_unlock_irqrestore(&sdp->sfd_lock, iflags);
>> +		kfree(sfp);
>>   		return ERR_PTR(-ENODEV);
>>   	}
>>   	list_add_tail(&sfp->sfd_siblings, &sdp->sfds);
> You're right. It's a memory leak.

Signed-off-by: Douglas Gilbert <dgilbert@interlog.com>


There also a memory leak at the second 'return NULL;'
in dev_seq_start() .


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

end of thread, other threads:[~2013-09-26  4:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1380119219-13486-1-git-send-email-vegard.nossum@oracle.com>
2013-09-26  2:05 ` [PATCH] sg: fix memory leak vaughan
2013-09-26  4:31   ` Douglas Gilbert

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