summaryrefslogtreecommitdiff
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2016-09-15 03:22:57 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-01-17 00:16:07 +0300
commit731b8667952815844de39412fb202292cf679f38 (patch)
treec9e46bff365fa384d09a804f5752f836b9de89c6 /fs/btrfs/disk-io.c
parent4b522570f9743b190319768144a52b9907c5d18a (diff)
downloadlinux-731b8667952815844de39412fb202292cf679f38.tar.xz
Btrfs: memset to avoid stale content in btree node block
commit 3eb548ee3a8042d95ad81be254e67a5222c24e03 upstream. 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> Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/btrfs/disk-io.c')
0 files changed, 0 insertions, 0 deletions