]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: avoid null dereference and leaks when bailing from open_ctree()
authorIlya Dryomov <idryomov@gmail.com>
Tue, 8 Nov 2011 22:08:15 +0000 (00:08 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 9 Nov 2011 20:53:38 +0000 (22:53 +0200)
commit60da32cdb948fb79be40febdec9297ffe8d58141
tree83f8e67439f0562ee9d4aa51cf1a3a0166d78f99
parent89d00ef2d2e0e90bc552fdd32c16c9f5616ee976
Btrfs: avoid null dereference and leaks when bailing from open_ctree()

Fix bugs introduced by aaf64d2c.  Firstly, after failing to allocate any
of the tree roots (first 'goto fail' in open_ctree()) we would
dereference a NULL fs_info pointer in free_fs_info().  Secondly, after
failures from init_srcu_struct(), setup_bdi() and new_inode() we would
leak all earlier allocated roots: fs_info fields haven't been
initialized yet so free_fs_info() is rendered useless.

Fix this by initializing fs_info pointer and fs_info fields before any
allocations happen.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/btrfs/disk-io.c