]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: scrub: Set bbio to NULL before calling btrfs_map_block
authorZhao Lei <zhaolei@cn.fujitsu.com>
Tue, 17 May 2016 09:37:38 +0000 (17:37 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 25 May 2016 20:15:21 +0000 (22:15 +0200)
commit1c5255ff500a7c83b46ce9f83b9588158240013c
tree4149ed8954a0c344b354769d1c9bbed9a8e54114
parent1f7c8f6c12fc3912a155aa5fb6230b4ac62098b4
btrfs: scrub: Set bbio to NULL before calling btrfs_map_block

We usually call btrfs_put_bbio() when btrfs_map_block() failed,
btrfs_put_bbio() works right whether bbio is a valid value, or NULL.

But there is a exception, in some case, btrfs_map_block() will return
fail without touching *bbio(keeping its original value), and if bbio
was not initialized yet, invalid memory accessing will happened.

Above case is in scrub_missing_raid56_pages(), and similar case in
scrub_raid56_parity().

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/scrub.c