From: Mariusz Kozlowski <mk@lab.zgora.pl>
To: Chris Mason <chris.mason@oracle.com>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Mariusz Kozlowski <mk@lab.zgora.pl>
Subject: [PATCH v2] btrfs: fix memory leak on error path in btrfs_get_acl()
Date: Thu, 16 Dec 2010 07:10:18 +0100 [thread overview]
Message-ID: <1292479818-5135-1-git-send-email-mk@lab.zgora.pl> (raw)
In-Reply-To: <20101216055637.GA4826@mako-laptop>
If posix_acl_from_xattr() fails we leak memory stored in 'value'.
Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl>
---
fs/btrfs/acl.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
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);
--
1.7.0.4
prev parent reply other threads:[~2010-12-16 6:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-15 21:57 [PATCH] btrfs: fix memory leak on error path in btrfs_get_acl() Mariusz Kozlowski
2010-12-15 22:49 ` Miguel Ojeda
2010-12-16 5:56 ` Mariusz Kozlowski
2010-12-16 6:10 ` Mariusz Kozlowski [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=1292479818-5135-1-git-send-email-mk@lab.zgora.pl \
--to=mk@lab.zgora.pl \
--cc=chris.mason@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).