public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH][v2] btrfs: only search for left_info if there is no right_info
Date: Mon, 27 Jul 2020 13:55:28 +0200	[thread overview]
Message-ID: <20200727115528.GJ3703@twin.jikos.cz> (raw)
In-Reply-To: <20200722184537.19896-1-josef@toxicpanda.com>

On Wed, Jul 22, 2020 at 02:45:37PM -0400, Josef Bacik wrote:
> The CVE referenced doesn't actually trigger the problem anymore because
> of the tree-checker improvements, however the underlying issue can still
> happen.

What was the problem?

> If we find a right_info, but rb_prev() is NULL, then we're the furthest
> most item in the tree currently, and there will be no left_info.
> However we'll still search from offset-1, which would return right_info
> again which we store in left_info.  If we then free right_info we'll
> have free'd left_info as well, and boom, UAF.  Instead fix this check so
> that if we don't have a right_info we do the search for the left_info,
> otherwise left_info comes from rb_prev or is simply NULL as it should
> be.
> 
> Reference: CVE-2019-19448
> Fixes: 963030817060 ("Btrfs: use hybrid extents+bitmap rb tree for free space")
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
> v1->v2:
> - Fixed the title, I had changed the fix but forgot to change the title in v1

The title still repeats what the code does and left_info or right_info
are not terms that are understood without context (unlike eg. fs_info)

      reply	other threads:[~2020-07-27 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 18:42 [PATCH] btrfs: unset left_info if it matches right_info Josef Bacik
2020-07-22 18:45 ` [PATCH][v2] btrfs: only search for left_info if there is no right_info Josef Bacik
2020-07-27 11:55   ` David Sterba [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=20200727115528.GJ3703@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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