diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-06-25 07:15:23 -0400 |
---|---|---|
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) |
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 646ee21bb035..c5dbd9149679 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) | |||
1239 | node->bytenr, &node->rb_node); | 1239 | node->bytenr, &node->rb_node); |
1240 | spin_unlock(&rc->reloc_root_tree.lock); | 1240 | spin_unlock(&rc->reloc_root_tree.lock); |
1241 | if (rb_node) { | 1241 | if (rb_node) { |
1242 | kfree(node); | ||
1243 | btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " | 1242 | btrfs_panic(root->fs_info, -EEXIST, "Duplicate root found " |
1244 | "for start=%llu while inserting into relocation " | 1243 | "for start=%llu while inserting into relocation " |
1245 | "tree\n"); | 1244 | "tree\n"); |
1245 | kfree(node); | ||
1246 | return -EEXIST; | ||
1246 | } | 1247 | } |
1247 | 1248 | ||
1248 | list_add_tail(&root->root_list, &rc->reloc_roots); | 1249 | list_add_tail(&root->root_list, &rc->reloc_roots); |