]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Btrfs: detect corruption when non-root leaf has zero item
authorLiu Bo <bo.li.liu@oracle.com>
Tue, 23 Aug 2016 22:22:58 +0000 (15:22 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 28 Apr 2020 18:02:25 +0000 (19:02 +0100)
commit2cf92740c194ac78e9c3cc487e4a54fde2d18d8f
tree98bd49dc0da87be1aa673bb4bdc962e2493eda9b
parent0f28980ffa49f443f0ff7d6c7d4b11717c623f60
Btrfs: detect corruption when non-root leaf has zero item

commit 1ba98d086fe3a14d6a31f2f66dbab70c45d00f63 upstream.

Right now we treat leaf which has zero item as a valid one
because we could have an empty tree, that is, a root that is
also a leaf without any item, however, in the same case but
when the leaf is not a root, we can end up with hitting the
BUG_ON(1) in btrfs_extend_item() called by
setup_inline_extent_backref().

This makes us check the situation as a corruption if leaf is
not its own root.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/btrfs/disk-io.c