Btrfs: make sure we update latest_bdev
When we are setting up the mount, we close all the devices that were not actually part of the metadata we found. But, we don't make sure that one of those devices wasn't fs_devices->latest_bdev, which means we can do a use after free on the one we closed. This updates latest_bdev as it goes. Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
@@ -2305,6 +2305,12 @@ struct btrfs_root *open_ctree(struct super_block *sb,
|
||||
|
||||
btrfs_close_extra_devices(fs_devices);
|
||||
|
||||
if (!fs_devices->latest_bdev) {
|
||||
printk(KERN_CRIT "btrfs: failed to read devices on %s\n",
|
||||
sb->s_id);
|
||||
goto fail_tree_roots;
|
||||
}
|
||||
|
||||
retry_root_backup:
|
||||
blocksize = btrfs_level_size(tree_root,
|
||||
btrfs_super_root_level(disk_super));
|
||||
|
Reference in New Issue
Block a user