lkml.org 
[lkml]   [2011]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] btrfs: Mem leak in btrfs_get_acl()
Date
On Thu, 6 Jan 2011 22:45:21 +0100 (CET), Jesper Juhl <jj@chaosbits.net> wrote:
>
> It seems to me that we leak the memory allocated to 'value' in
> btrfs_get_acl() if the call to posix_acl_from_xattr() fails.
> Here's a patch that attempts to correct that problem.
>
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

I posted a similar patch long time back. But never got picked up

http://article.gmane.org/gmane.comp.file-systems.btrfs/6164

Message-id:"1279547924-25141-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com"

> ---
> acl.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> compile tested only.
>
> diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
> index 2222d16..6d1410e 100644
> --- a/fs/btrfs/acl.c
> +++ b/fs/btrfs/acl.c
> @@ -60,8 +60,10 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
> size = __btrfs_getxattr(inode, name, value, size);
> if (size > 0) {
> acl = posix_acl_from_xattr(value, size);
> - if (IS_ERR(acl))
> + if (IS_ERR(acl)) {
> + kfree(value);
> return acl;
> + }
> set_cached_acl(inode, type, acl);
> }
> kfree(value);
>
>


-aneesh


\
 
 \ /
  Last update: 2011-01-07 10:25    [W:0.087 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site