public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: vaughan <vaughan.cao@oracle.com>
To: Vegard Nossum <vegard.nossum@oracle.com>
Cc: James Bottomley <JBottomley@Parallels.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Douglas Gilbert <dgilbert@interlog.com>
Subject: Re: [PATCH] sg: fix memory leak
Date: Thu, 26 Sep 2013 10:05:48 +0800	[thread overview]
Message-ID: <5243967C.2010203@oracle.com> (raw)
In-Reply-To: <1380119219-13486-1-git-send-email-vegard.nossum@oracle.com>

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

       reply	other threads:[~2013-09-26  2:05 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 ` vaughan [this message]
2013-09-26  4:31   ` [PATCH] sg: fix memory leak Douglas Gilbert

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=5243967C.2010203@oracle.com \
    --to=vaughan.cao@oracle.com \
    --cc=JBottomley@Parallels.com \
    --cc=dgilbert@interlog.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --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