* [PATCH] BTRFS: Don't leak memory in btrfs_get_acl()
@ 2010-12-24 22:45 Jesper Juhl
2010-12-25 15:02 ` Mariusz Kozlowski
0 siblings, 1 reply; 3+ messages in thread
From: Jesper Juhl @ 2010-12-24 22:45 UTC (permalink / raw)
To: linux-btrfs; +Cc: Chris Mason, linux-kernel
Hi,
Currrently we leak memory in btrfs_get_acl::btrfs_get_acl() if
posix_acl_from_xattr() fails. With this patch we do not.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
acl.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
--
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] BTRFS: Don't leak memory in btrfs_get_acl()
2010-12-24 22:45 [PATCH] BTRFS: Don't leak memory in btrfs_get_acl() Jesper Juhl
@ 2010-12-25 15:02 ` Mariusz Kozlowski
2010-12-25 17:42 ` Jesper Juhl
0 siblings, 1 reply; 3+ messages in thread
From: Mariusz Kozlowski @ 2010-12-25 15:02 UTC (permalink / raw)
To: Jesper Juhl; +Cc: linux-btrfs, Chris Mason, linux-kernel
On Fri, Dec 24, 2010 at 11:45:21PM +0100, Jesper Juhl wrote:
> Hi,
>
> Currrently we leak memory in btrfs_get_acl::btrfs_get_acl() if
> posix_acl_from_xattr() fails. With this patch we do not.
I sent similar patch some time ago but no reply from Chris so far.
http://marc.info/?l=linux-kernel&m=129247984126414
--
Mariusz Kozlowski
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] BTRFS: Don't leak memory in btrfs_get_acl()
2010-12-25 15:02 ` Mariusz Kozlowski
@ 2010-12-25 17:42 ` Jesper Juhl
0 siblings, 0 replies; 3+ messages in thread
From: Jesper Juhl @ 2010-12-25 17:42 UTC (permalink / raw)
To: Mariusz Kozlowski; +Cc: linux-btrfs, Chris Mason, linux-kernel
On Sat, 25 Dec 2010, Mariusz Kozlowski wrote:
> On Fri, Dec 24, 2010 at 11:45:21PM +0100, Jesper Juhl wrote:
> > Hi,
> >
> > Currrently we leak memory in btrfs_get_acl::btrfs_get_acl() if
> > posix_acl_from_xattr() fails. With this patch we do not.
>
> I sent similar patch some time ago but no reply from Chris so far.
>
> http://marc.info/?l=linux-kernel&m=129247984126414
>
I was not aware of that. The patch looks fine (identical to mine), so I
think Chris should just merge yours.
Feel free to add:
Reviewed-by: Jesper Juhl <jj@chaosbits.net>
--
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-12-25 17:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-24 22:45 [PATCH] BTRFS: Don't leak memory in btrfs_get_acl() Jesper Juhl
2010-12-25 15:02 ` Mariusz Kozlowski
2010-12-25 17:42 ` Jesper Juhl
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®