]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: validate root::reloc_root after recording root in trans
authorJosef Bacik <josef@toxicpanda.com>
Fri, 12 Mar 2021 20:25:15 +0000 (15:25 -0500)
committerDavid Sterba <dsterba@suse.com>
Tue, 6 Apr 2021 17:50:02 +0000 (19:50 +0200)
commit879df1eea5dfe8bd7dda29c0a9345cc079e05524
treeb1af8c78f76301ed23ad043d695c05868d5bd909
parentbe4d4807dee9a614000e6aabd3a6b7b973c98b48
btrfs: validate root::reloc_root after recording root in trans

If we fail to setup a root->reloc_root in a different thread that path
will error out, however it still leaves root->reloc_root NULL but would
still appear set up in the transaction.  Subsequent calls to
btrfs_record_root_in_transaction would succeed without attempting to
create the reloc root, as the transid has already been updated.

Handle this case by making sure we have a root->reloc_root set after a
btrfs_record_root_in_transaction call so we don't end up dereferencing a
NULL pointer.

Reported-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/relocation.c