From: Christian Brauner <brauner@kernel.org>
To: Dongliang Mu <dzm91@hust.edu.cn>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Dongliang Mu <mudongliangabcd@gmail.com>,
butt3rflyh4ck <butterflyhuangxx@gmail.com>,
Hao Sun <sunhao.th@gmail.com>, Jiacheng Xu <stitch@zju.edu.cn>,
stable@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] fs: fix UAF/GPF bug in nilfs_mdt_destroy
Date: Tue, 16 Aug 2022 12:46:42 +0200 [thread overview]
Message-ID: <20220816104642.qmjegdtthyzy5xbv@wittgenstein> (raw)
In-Reply-To: <20220816040859.659129-1-dzm91@hust.edu.cn>
On Tue, Aug 16, 2022 at 12:08:58PM +0800, Dongliang Mu wrote:
> From: Dongliang Mu <mudongliangabcd@gmail.com>
>
> In alloc_inode, inode_init_always() could return -ENOMEM if
> security_inode_alloc() fails, which causes inode->i_private
> uninitialized. Then nilfs_is_metadata_file_inode() returns
> true and nilfs_free_inode() wrongly calls nilfs_mdt_destroy(),
> which frees the uninitialized inode->i_private
> and leads to crashes(e.g., UAF/GPF).
>
> Fix this by moving security_inode_alloc just prior to
> this_cpu_inc(nr_inodes)
>
> Link: https://lkml.kernel.org/r/CAFcO6XOcf1Jj2SeGt=jJV59wmhESeSKpfR0omdFRq+J9nD1vfQ@mail.gmail.com
> Reported-by: butt3rflyh4ck <butterflyhuangxx@gmail.com>
> Reported-by: Hao Sun <sunhao.th@gmail.com>
> Reported-by: Jiacheng Xu <stitch@zju.edu.cn>
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: stable@vger.kernel.org
> ---
Looks good to me,
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
next prev parent reply other threads:[~2022-08-16 11:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 4:08 [PATCH v2] fs: fix UAF/GPF bug in nilfs_mdt_destroy Dongliang Mu
2022-08-16 10:46 ` Christian Brauner [this message]
2022-08-25 19:45 ` Eric Sandeen
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=20220816104642.qmjegdtthyzy5xbv@wittgenstein \
--to=brauner@kernel.org \
--cc=butterflyhuangxx@gmail.com \
--cc=dzm91@hust.edu.cn \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mudongliangabcd@gmail.com \
--cc=stable@vger.kernel.org \
--cc=stitch@zju.edu.cn \
--cc=sunhao.th@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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).