From: Josef Bacik <josef@toxicpanda.com>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix use-after-free on root->orphan_block_rsv
Date: Fri, 26 Jan 2018 09:21:11 -0500 [thread overview]
Message-ID: <20180126142110.srvh55d733hfaxaj@destiny> (raw)
In-Reply-To: <20180125180256.10844-7-bo.li.liu@oracle.com>
On Thu, Jan 25, 2018 at 11:02:54AM -0700, Liu Bo wrote:
> I got these from running generic/475,
>
> WARNING: CPU: 0 PID: 26384 at fs/btrfs/inode.c:3326 btrfs_orphan_commit_root+0x1ac/0x2b0 [btrfs]
> BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
> IP: btrfs_block_rsv_release+0x1c/0x70 [btrfs]
> Call Trace:
> btrfs_orphan_release_metadata+0x9f/0x200 [btrfs]
> btrfs_orphan_del+0x10d/0x170 [btrfs]
> btrfs_setattr+0x500/0x640 [btrfs]
> notify_change+0x7ae/0x870
> do_truncate+0xca/0x130
> vfs_truncate+0x2ee/0x3d0
> do_sys_truncate+0xaf/0xf0
> SyS_truncate+0xe/0x10
> entry_SYSCALL_64_fastpath+0x1f/0x96
>
> The race is between btrfs_orphan_commit_root and btrfs_orphan_del,
> t1 t2
> btrfs_orphan_commit_root btrfs_orphan_del
> spin_lock
> check (&root->orphan_inodes)
> root->orphan_block_rsv = NULL;
> spin_unlock
> atomic_dec(&root->orphan_inodes);
> access root->orphan_block_rsv
>
> Accessing root->orphan_block_rsv must be done before decreasing
> root->orphan_inodes.
>
> cc: <stable@vger.kernel.org> v3.12+
> Fixes: 703c88e03524 ("Btrfs: fix tracking of orphan inode count")
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
prev parent reply other threads:[~2018-01-26 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 18:02 [PATCH] Btrfs: fix use-after-free on root->orphan_block_rsv Liu Bo
2018-01-26 14:21 ` Josef Bacik [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=20180126142110.srvh55d733hfaxaj@destiny \
--to=josef@toxicpanda.com \
--cc=bo.li.liu@oracle.com \
--cc=linux-btrfs@vger.kernel.org \
/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).