mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org,
	James Bottomley <James.Bottomley@suse.de>,
	linux-scsi <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] target: Fix memory leak in fd_set_configfs_dev_params().
Date: Sun, 16 Jan 2011 15:19:48 -0800	[thread overview]
Message-ID: <1295219988.22813.72.camel@haakon2.linux-iscsi.org> (raw)
In-Reply-To: <alpine.LNX.2.00.1101162357250.13377@swampdragon.chaosbits.net>

On Sun, 2011-01-16 at 23:59 +0100, Jesper Juhl wrote:
> On Sun, 16 Jan 2011, Nicholas A. Bellinger wrote:
> 
> > On Sun, 2011-01-16 at 20:17 +0100, Jesper Juhl wrote:
> > > match_strdup() dynamically allocates memory and it is the responsabillity 
> > > of the caller to free that memory. In 
> > > drivers/target/target_core_file.c::fd_set_configfs_dev_params() two calls 
> > > are made to match_strdup() and in neither case is the allocated memory 
> > > freed, but instead it is leaked.
> > > 
> > > This patch should take care of the problem by kfree()'ing the allocated 
> > > memory once it is no longer needed. It also makes sure to return -ENOMEM 
> > > if the memory allocation in match_strdup() should fail.
> > > 
> > > Please review and consider for inclusion.
> > > 
> > > Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> > 
> > Ugh, this was my fault during the recent v4.0 configfs parameter
> > conversion.  Committed as 5c45b37 in lio-core-2.6.git/linus-38-rc1 and I
> > will fix up the other handful of match_strdup() breakage and carry into
> > scsi-post-merge-2.6.git/for-jejb shortly.
> > 
> > Thanks for catching this..
> > 
> 
> You're welcome.
> Yes, I did see a bunch of other match_strdup() related problems, but I 
> thought I'd just fix up one file initially to see the general reaction, 
> then do the rest later when this one had been merged. but if you want to 
> fix up the remainder, feel free.
> 
> I guess we can merge this patch as a starting point?
> 

Sure, the other two follow-up match_strdup() memory leak bugfix patches
for target/iblock and target_core_configfs.c APTPL metadata token
parsing have been included into the scsi-post-merge-2.6.git/for-jejb
queue.

Thanks again!

--nab


  reply	other threads:[~2011-01-16 23:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-16 19:17 Jesper Juhl
2011-01-16 22:54 ` Nicholas A. Bellinger
2011-01-16 22:59   ` Jesper Juhl
2011-01-16 23:19     ` Nicholas A. Bellinger [this message]
2011-01-17 18:29       ` Jesper Juhl
2011-01-17 22:16         ` Nicholas A. Bellinger
2011-01-17 22:21           ` Jesper Juhl

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=1295219988.22813.72.camel@haakon2.linux-iscsi.org \
    --to=nab@linux-iscsi.org \
    --cc=James.Bottomley@suse.de \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®