mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Jesper Juhl <jj@chaosbits.net>
Cc: linux-kernel@vger.kernel.org, Jan Kara <jack@suse.cz>,
	Ben Fennema <bfennema@falcon.csc.calpoly.edu>
Subject: Re: [PATCH] UDF: Close small mem leak in udf_find_entry()
Date: Thu, 6 Jan 2011 17:54:12 +0100	[thread overview]
Message-ID: <20110106165412.GO4641@quack.suse.cz> (raw)
In-Reply-To: <alpine.LNX.2.00.1012122313290.9206@swampdragon.chaosbits.net>

  Hi,

On Sun 12-12-10 23:18:15, Jesper Juhl wrote:
> There's a small memory leak in fs/udf/namei.c::udf_find_entry().
> 
> We dynamically allocate memory for 'fname' with kmalloc() and in most 
> situations we free it before we leave the function, but there is one 
> situation where we do not (but should). This patch closes the leak by 
> jumping to the 'out_ok' label which does the correct cleanup rather than 
> doing half the cleanup and returning directly.
   Thanks. Merged.

								Honza
> 
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>
> ---
>  namei.c |    6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
>  compile tested only
> 
> diff --git a/fs/udf/namei.c b/fs/udf/namei.c
> index 6d8dc02..899ef91 100644
> --- a/fs/udf/namei.c
> +++ b/fs/udf/namei.c
> @@ -228,10 +228,8 @@ static struct fileIdentDesc *udf_find_entry(struct inode *dir,
>  		}
>  
>  		if ((cfi->fileCharacteristics & FID_FILE_CHAR_PARENT) &&
> -		    isdotdot) {
> -			brelse(epos.bh);
> -			return fi;
> -		}
> +		    isdotdot)
> +			goto out_ok;
>  
>  		if (!lfi)
>  			continue;
> 
> 
> 
> -- 
> Jesper Juhl <jj@chaosbits.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.
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2011-01-06 16:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-12 22:18 Jesper Juhl
2011-01-06 16:54 ` Jan Kara [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=20110106165412.GO4641@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=bfennema@falcon.csc.calpoly.edu \
    --cc=jj@chaosbits.net \
    --cc=linux-kernel@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®