Btrfs: check if extent buffer is aligned to sectorsize
authorLiu Bo <bo.li.liu@oracle.com>
Mon, 6 Jun 2016 19:01:23 +0000 (12:01 -0700)
committerDavid Sterba <dsterba@suse.com>
Fri, 17 Jun 2016 16:32:40 +0000 (18:32 +0200)
commitc871b0f2fd27e7f9097d507f47de5270f88003b9
tree76635b17aa4948c8a8af7f9da1a3a8225ac2d518
parent16ff4b454f1b56e8d89a9075feed0dd6ac510c3d
Btrfs: check if extent buffer is aligned to sectorsize

Thanks to fuzz testing, we can pass an invalid bytenr to extent buffer
via alloc_extent_buffer().  An unaligned eb can have more pages than it
should have, which ends up extent buffer's leak or some corrupted content
in extent buffer.

This adds a warning to let us quickly know what was happening.

Now that alloc_extent_buffer() no more returns NULL, this changes its
caller and callers of its caller to match with the new error
handling.

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/ctree.c
fs/btrfs/disk-io.c
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c