Skip to content
Commit 7e662854 authored by Qinghuang Feng's avatar Qinghuang Feng Committed by Chris Mason
Browse files

Btrfs: open_ctree() error handling can oops on fs_info



a bug in open_ctree:

struct btrfs_root *open_ctree(..)
{
....
	if (!extent_root || !tree_root || !fs_info ||
	    !chunk_root || !dev_root || !csum_root) {
		err = -ENOMEM;
		goto fail;
//When code flow goes to "fail", fs_info may be NULL or uninitialized.
	}
....

fail:
	btrfs_close_devices(fs_info->fs_devices);// !
	btrfs_mapping_tree_free(&fs_info->mapping_tree);// !

	kfree(extent_root);
	kfree(tree_root);
	bdi_destroy(&fs_info->bdi);// !
...
)

Signed-off-by: default avatarQinghuang Feng <qhfeng.kernel@gmail.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 86288a19
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment