From: Greg Kurz <groug@kaod.org>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: linux-kernel@vger.kernel.org, Latchesar Ionkov <lucho@ionkov.net>,
Ron Minnich <rminnich@sandia.gov>,
jack@suse.cz, Eric Van Hensbergen <ericvh@gmail.com>,
salyzyn@android.com, v9fs-developer@lists.sourceforge.net
Subject: Re: [V9fs-developer] [Patch] 9p: fix a potential acl leak
Date: Wed, 14 Dec 2016 09:57:48 +0100 [thread overview]
Message-ID: <20161214095748.53cd9d9c@bahia.lan> (raw)
In-Reply-To: <1481654014-5563-1-git-send-email-xiyou.wangcong@gmail.com>
On Tue, 13 Dec 2016 10:33:34 -0800
Cong Wang <xiyou.wangcong@gmail.com> wrote:
> posix_acl_update_mode() could possibly clear 'acl', if so
> we leak the memory pointed by 'acl'. Save this pointer
> before calling posix_acl_update_mode() and release the memory
> if 'acl' really gets cleared.
>
> Reported-by: Mark Salyzyn <salyzyn@android.com>
> Reviewed-by: Jan Kara <jack@suse.cz>
> Cc: Eric Van Hensbergen <ericvh@gmail.com>
> Cc: Ron Minnich <rminnich@sandia.gov>
> Cc: Latchesar Ionkov <lucho@ionkov.net>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> ---
Reviewed-by: Greg Kurz <groug@kaod.org>
> fs/9p/acl.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/9p/acl.c b/fs/9p/acl.c
> index b3c2cc7..082d227 100644
> --- a/fs/9p/acl.c
> +++ b/fs/9p/acl.c
> @@ -277,6 +277,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
> case ACL_TYPE_ACCESS:
> if (acl) {
> struct iattr iattr;
> + struct posix_acl *old_acl = acl;
>
> retval = posix_acl_update_mode(inode, &iattr.ia_mode, &acl);
> if (retval)
> @@ -287,6 +288,7 @@ static int v9fs_xattr_set_acl(const struct xattr_handler *handler,
> * by the mode bits. So don't
> * update ACL.
> */
> + posix_acl_release(old_acl);
> value = NULL;
> size = 0;
> }
prev parent reply other threads:[~2016-12-14 13:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-13 18:33 Cong Wang
2016-12-14 8:57 ` Greg Kurz [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=20161214095748.53cd9d9c@bahia.lan \
--to=groug@kaod.org \
--cc=ericvh@gmail.com \
--cc=jack@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=rminnich@sandia.gov \
--cc=salyzyn@android.com \
--cc=v9fs-developer@lists.sourceforge.net \
--cc=xiyou.wangcong@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
Powered by JetHome