• Zhao Lei's avatar
    btrfs: scrub: Set bbio to NULL before calling btrfs_map_block · f1fee653
    Zhao Lei authored
    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: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    f1fee653
scrub.c 114 KB