linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Pan Bian <bianpan2016@163.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>,
	Wang Shilong <wangsl.fnst@cn.fujitsu.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: relocation: set trans to be NULL after free
Date: Fri, 23 Nov 2018 13:46:49 +0100	[thread overview]
Message-ID: <20181123124648.GB2842@twin.jikos.cz> (raw)
In-Reply-To: <1542967815-14547-1-git-send-email-bianpan2016@163.com>

On Fri, Nov 23, 2018 at 06:10:15PM +0800, Pan Bian wrote:
> The function relocate_block_group calls btrfs_end_transaction to release
> trans when update_backref_cache returns 1, and then continues the loop
> body. If btrfs_block_rsv_refill fails this time, it will jump out the
> loop and the freed trans will be accessed. This may result in a
> use-after-free bug. The patch assigns NULL to trans after trans is
> released so that it will not be accessed.
> 
> Fixes: 0647bf564f1("Btrfs: improve forever loop when doing balance
> relocation")
> 
> Signed-off-by: Pan Bian <bianpan2016@163.com>

Good catch, thanks.

Reviewed-by: David Sterba <dsterba@suse.com>

      parent reply	other threads:[~2018-11-23 12:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23 10:10 [PATCH] btrfs: relocation: set trans to be NULL after free Pan Bian
2018-11-23 11:18 ` Qu Wenruo
2018-11-23 12:46 ` 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=20181123124648.GB2842@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=bianpan2016@163.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wangsl.fnst@cn.fujitsu.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).