public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: vaughan <vaughan.cao@oracle.com>,
	Vegard Nossum <vegard.nossum@oracle.com>
Cc: James Bottomley <JBottomley@Parallels.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] sg: fix memory leak
Date: Thu, 26 Sep 2013 00:31:22 -0400	[thread overview]
Message-ID: <5243B89A.6060802@interlog.com> (raw)
In-Reply-To: <5243967C.2010203@oracle.com>

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() .


      reply	other threads:[~2013-09-26  4:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5243B89A.6060802@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=JBottomley@Parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vaughan.cao@oracle.com \
    --cc=vegard.nossum@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox