diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-06-25 05:15:23 -0600 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2012-07-23 16:27:53 -0400 |
commit | 23291a044c31f9dfdeaf633b631059fb75e5c2c4 (patch) | |
tree | 312f2561eec756a4cb585c6c02069d546880f63f /fs/btrfs/relocation.c | |
parent | 44c44af2f4a6dc1595f1711cf307bd01062fd129 (diff) | |
download | op-kernel-dev-23291a044c31f9dfdeaf633b631059fb75e5c2c4.zip op-kernel-dev-23291a044c31f9dfdeaf633b631059fb75e5c2c4.tar.gz |
Btrfs: fix error handling in __add_reloc_root()
We dereferenced "node" in the error message after freeing it. Also
btrfs_panic() can return so we should return an error code instead of
continuing.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r-- | fs/btrfs/relocation.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 646ee21..c5dbd91 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -1239,10 +1239,11 @@ static int __must_check __add_reloc_root(struct btrfs_root *root) node->bytenr, &node->rb_node); spin_unlock(&rc->reloc_root_tree.lock); if (rb_node) { - kfree(node); btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " "for start=%llu while inserting into relocation " "tree\n"); + kfree(node); + return -EEXIST; } list_add_tail(&root->root_list, &rc->reloc_roots); |