]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
Btrfs: memset to avoid stale content in btree node block
authorLiu Bo <bo.li.liu@oracle.com>
Thu, 15 Sep 2016 00:22:57 +0000 (17:22 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 26 Sep 2016 16:03:47 +0000 (18:03 +0200)
commit3eb548ee3a8042d95ad81be254e67a5222c24e03
tree4c43a736bd3ea8f094c060afed9c000278e65348
parent3561b9db70928f207be4570b48fc19898eeaef54
Btrfs: memset to avoid stale content in btree node block

During updating btree, we could push items between sibling
nodes/leaves, for leaves data sections starts reversely from
the end of the block while for nodes we only have key pairs
which are stored one by one from the start of the block.

So we could do try to push key pairs from one node to the next
node right in the tree, and after that, we update the node's
nritems to reflect the correct end while leaving the stale
content in the node.  One may intentionally corrupt the fs
image and access the stale content by bumping the nritems and
causes various crashes.

This takes the in-memory @nritems as the correct one and
gets to memset the unused part of a btree node.

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>
fs/btrfs/extent_io.c