From: Mariusz Kozlowski <mk@lab.zgora.pl>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Mariusz Kozlowski <mk@lab.zgora.pl>,
Chris Mason <chris.mason@oracle.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: fix memory leak on error path in btrfs_get_acl()
Date: Thu, 16 Dec 2010 06:56:37 +0100 [thread overview]
Message-ID: <20101216055637.GA4826@mako-laptop> (raw)
In-Reply-To: <AANLkTi=Zz8eQTS+ja59eB9-F1aE2QP5DEVCwqBP50j8K@mail.gmail.com>
On Wed, Dec 15, 2010 at 11:49:39PM +0100, Miguel Ojeda wrote:
> On Wed, Dec 15, 2010 at 10:57 PM, Mariusz Kozlowski <mk@lab.zgora.pl>=
wrote:
> > If posix_acl_from_xattr() fails we leak memory stored in 'value'.
> >
> > Signed-off-by: Mariusz Kozlowski <mk@lab.zgora.pl>
> > ---
> > =A0fs/btrfs/acl.c | =A0 =A01 +
> > =A01 files changed, 1 insertions(+), 0 deletions(-)
> >
> > diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
> > index 2222d16..11c9561 100644
> > --- a/fs/btrfs/acl.c
> > +++ b/fs/btrfs/acl.c
> > @@ -61,6 +61,7 @@ static struct posix_acl *btrfs_get_acl(struct ino=
de *inode, int type)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (size > 0) {
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acl =3D posix_acl_fr=
om_xattr(value, size);
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (IS_ERR(acl))
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 kfree=
(value);
>=20
> Be careful with the evil { }
Dang. Too much python recently i guess. Will send v2 shortly.
Thanks.
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0retu=
rn acl;
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0set_cached_acl(inode=
, type, acl);
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}
> > --
> > 1.7.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-ker=
nel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at =A0http://vger.kernel.org/majordomo-info.htm=
l
> > Please read the FAQ at =A0http://www.tux.org/lkml/
> >
--=20
Mariusz Kozlowski
next prev parent reply other threads:[~2010-12-16 5:56 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 [this message]
2010-12-16 6:10 ` [PATCH v2] " Mariusz Kozlowski
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=20101216055637.GA4826@mako-laptop \
--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).