Skip to content
  • Jan Kara's avatar
    block: Initialize bd_bdi on inode initialization · a5a79d00
    Jan Kara authored
    
    
    So far we initialized bd_bdi only in bdget(). That is fine for normal
    bdev inodes however for the special case of the root inode of
    blockdev_superblock that function is never called and thus bd_bdi is
    left uninitialized. As a result bdev_evict_inode() may oops doing
    bdi_put(root->bd_bdi) on that inode as can be seen when doing:
    
    mount -t bdev none /mnt
    
    Fix the problem by initializing bd_bdi when first allocating the inode
    and then reinitializing bd_bdi in bdev_evict_inode().
    
    Thanks to syzkaller team for finding the problem.
    
    Reported-by: default avatarDmitry Vyukov <dvyukov@google.com>
    Fixes: b1d2dc56
    
     ("block: Make blk_get_backing_dev_info() safe without open bdev")
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Signed-off-by: default avatarJens Axboe <axboe@fb.com>
    a5a79d00