public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Robert Love <robert.w.love@intel.com>
To: Joe Eykholt <jeykholt@cisco.com>
Cc: Hillf Danton <dhillf@gmail.com>,
	devel@open-fcoe.org, linux-scsi@vger.kernel.org
Subject: Re: [Open-FCoE] [PATCH 1/2] libfc: fix memory leakage in local port
Date: Thu, 28 Oct 2010 16:35:22 -0700	[thread overview]
Message-ID: <1288308922.1431.204.camel@fritz> (raw)
In-Reply-To: <4CCA07CE.2060702@cisco.com>

On Thu, 2010-10-28 at 16:31 -0700, Joe Eykholt wrote:
> 
> On 10/28/10 4:12 PM, Robert Love wrote:
> > On Wed, 2010-10-27 at 20:40 +0800, Hillf Danton wrote:
> >> There seems info should get freed when error encountered.
> >>
> >> Signed-off-by: Hillf Danton <dhillf@gmail.com>
> >> ---
> >>
> >> --- a/drivers/scsi/libfc/fc_lport.c	2010-09-13 07:07:38.000000000 +0800
> >> +++ b/drivers/scsi/libfc/fc_lport.c	2010-10-27 20:33:36.000000000 +0800
> >> @@ -1766,8 +1766,10 @@ static int fc_lport_ct_request(struct fc
> >>  	info->sg = job->reply_payload.sg_list;
> >>
> >>  	if (!lport->tt.exch_seq_send(lport, fp, fc_lport_bsg_resp,
> >> -				     NULL, info, tov))
> >> +				     NULL, info, tov)) {
> >> +		kfree(info);
> > 
> > We cannot free the BSG info here. If you look at fc_exch_seq_send you
> > can see that it's attached to the exchange and then when the response is
> > received it is passed to the response handler, in the case
> > fc_lport_bsg_resp, where it is free'd.
> 
> This is on failure of seq_send().  It's confusing because that returns the
> sequence, which is NULL on error.  So, I think the kfree() is correct.
> 
> > 
> >>  		return -ECOMM;

Ah, you're right... and that's why we return an error. Thanks Joe.


      reply	other threads:[~2010-10-28 23:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 12:40 [PATCH 1/2] libfc: fix memory leakage in local port Hillf Danton
2010-10-27 12:43 ` [PATCH 2/2] " Hillf Danton
2010-10-28 23:13   ` [Open-FCoE] " Robert Love
2010-10-28 23:12 ` [Open-FCoE] [PATCH 1/2] " Robert Love
2010-10-28 23:31   ` Joe Eykholt
2010-10-28 23:35     ` Robert Love [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=1288308922.1431.204.camel@fritz \
    --to=robert.w.love@intel.com \
    --cc=devel@open-fcoe.org \
    --cc=dhillf@gmail.com \
    --cc=jeykholt@cisco.com \
    --cc=linux-scsi@vger.kernel.org \
    /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