linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Eykholt <jeykholt@cisco.com>
To: Robert Love <robert.w.love@intel.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:31:26 -0700	[thread overview]
Message-ID: <4CCA07CE.2060702@cisco.com> (raw)
In-Reply-To: <1288307525.1431.201.camel@fritz>



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;
>> +	}
>>  	return 0;
>>  }
>> _______________________________________________
>> devel mailing list
>> devel@open-fcoe.org
>> http://www.open-fcoe.org/mailman/listinfo/devel
> 
> 
> _______________________________________________
> devel mailing list
> devel@open-fcoe.org
> http://www.open-fcoe.org/mailman/listinfo/devel

  reply	other threads:[~2010-10-28 23:31 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 [this message]
2010-10-28 23:35     ` Robert Love

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=4CCA07CE.2060702@cisco.com \
    --to=jeykholt@cisco.com \
    --cc=devel@open-fcoe.org \
    --cc=dhillf@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=robert.w.love@intel.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;
as well as URLs for NNTP newsgroup(s).