Qinghuang Feng 7e6628544a 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: Qinghuang Feng <qhfeng.kernel@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
2009-01-21 10:49:16 -05:00
..
2009-01-05 21:25:51 -05:00
2009-01-05 21:25:51 -05:00
2009-01-21 10:49:16 -05:00
2009-01-05 21:25:51 -05:00
2008-12-08 16:46:26 -05:00
2009-01-05 21:25:51 -05:00
2008-09-25 11:04:06 -04:00
2009-01-06 11:42:00 -05:00
2008-09-25 11:04:06 -04:00
2009-01-05 21:25:51 -05:00
2009-01-21 10:59:08 -05:00
2009-01-05 21:25:51 -05:00
2008-10-29 14:49:59 -04:00
2009-01-21 10:59:08 -05:00
2009-01-05 21:25:51 -05:00
2009-01-05 21:25:51 -05:00
2008-09-29 15:18:18 -04:00
2009-01-05 21:25:51 -05:00
2009-01-05 21:25:51 -05:00
2009-01-21 10:59:08 -05:00
2009-01-21 10:59:08 -05:00
2008-12-12 10:03:26 -05:00
2009-01-21 10:49:16 -05:00
2008-09-25 11:04:07 -04:00
2009-01-05 21:25:51 -05:00