OSDN Git Service

btrfs: do not delete mismatched root refs
authorJosef Bacik <josef@toxicpanda.com>
Wed, 18 Dec 2019 22:20:29 +0000 (17:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Jan 2020 07:21:31 +0000 (08:21 +0100)
commit3b5a4a18a762824998c6f962c5168ea9a0d61923
tree7a35632ac29971d4c77a2a8b66e5ecb5d6d17ef7
parentd110e93beb13bc9172f9137687bb2e533af487d8
btrfs: do not delete mismatched root refs

commit 423a716cd7be16fb08690760691befe3be97d3fc upstream.

btrfs_del_root_ref() will simply WARN_ON() if the ref doesn't match in
any way, and then continue to delete the reference.  This shouldn't
happen, we have these values because there's more to the reference than
the original root and the sub root.  If any of these checks fail, return
-ENOENT.

CC: stable@vger.kernel.org # 4.4+
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/root-tree.c