[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LNX.2.00.1101162357250.13377@swampdragon.chaosbits.net>
Date: Sun, 16 Jan 2011 23:59:36 +0100 (CET)
From: Jesper Juhl <jj@...osbits.net>
To: "Nicholas A. Bellinger" <nab@...ux-iscsi.org>
cc: linux-kernel@...r.kernel.org,
James Bottomley <James.Bottomley@...e.de>
Subject: Re: [PATCH] target: Fix memory leak in
fd_set_configfs_dev_params().
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@...osbits.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?
--
Jesper Juhl <jj@...osbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists