mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: Mingming Cao <cmm@us.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-ext4@vger.kernel.org, Andy Whitcroft <apw@shadowen.org>
Subject: Re: [EXT4 set 5][PATCH 1/1] expand inode i_extra_isize to support features in larger inode
Date: Mon, 16 Jul 2007 18:06:33 -0600	[thread overview]
Message-ID: <20070717000633.GX5992@schatzie.adilger.int> (raw)
In-Reply-To: <1184629924.3836.5.camel@localhost.localdomain>

On Jul 16, 2007  16:52 -0700, Mingming Cao wrote:
> I am not sure why we need GFP_KERNEL flag here. I think we should use
> GFP_NOFS instead. The following patch use the GFP_NOFS flag, as well as
> fixing memory leak issue introduced by the ext4 expand inode extra isize
> patch.
> 
> Fixing memory allocation issue with expand inode extra isize patch.
> 
> - use GFP_NOFS instead of GFP_KERNEL flag for memory allocation
> - use kzalloc instead of kmalloc

This doesn't need kzalloc() for buffer and b_entry_name, since they are
immediately overwritten by memcpy().

> - fix memory leak in the success case, at the end of while loop.
>  			goto cleanup;
> @@ -1302,7 +1302,15 @@ retry:
>  		error = ext4_xattr_block_set(handle, inode, &i, bs);
>  		if (error)
>  			goto cleanup;
> +		kfree(b_entry_name);
> +		kfree(buffer);
> +		brelse(is->iloc.bh);
> +		kfree(is);
> +		kfree(bs);
> +		brelse(bh);
>  	}
> +	up_write(&EXT4_I(inode)->xattr_sem);
> +        return 0;
>  
>  cleanup:
>  	kfree(b_entry_name);

I don't think you should have brelse(bh) inside the loop, since it is
allocated before the loop starts.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.


  reply	other threads:[~2007-07-17  0:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-01  7:38 Mingming Cao
2007-07-10 23:32 ` Andrew Morton
2007-07-11 12:10   ` Andreas Dilger
2007-07-11 17:34     ` Andrew Morton
2007-07-11 19:24       ` Kalpak Shah
2007-07-12 11:22   ` Andy Whitcroft
2007-07-12 12:14   ` Kalpak Shah
2007-07-13  9:05   ` Andrew Morton
2007-07-13 13:33     ` Peter Zijlstra
2007-07-13 15:43       ` Andreas Dilger
2007-07-13 19:12       ` Andrew Morton
2007-07-13 21:47         ` Zach Brown
2007-07-14  7:43           ` Peter Zijlstra
2007-07-15 10:21           ` Peter Zijlstra
2007-07-15 13:02           ` Peter Zijlstra
2007-07-15 13:14             ` Peter Zijlstra
2007-07-15 18:11             ` Andrew Morton
2007-07-15 19:21               ` Peter Zijlstra
2007-07-15 19:59                 ` Andrew Morton
2007-07-15 20:13                   ` Peter Zijlstra
2007-07-13 16:12     ` Andreas Dilger
2007-07-16 23:52     ` Mingming Cao
2007-07-17  0:06       ` Andreas Dilger [this message]
2007-07-17  0:24         ` Mingming Cao

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=20070717000633.GX5992@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@shadowen.org \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --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®