summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorTsutomu Itoh <t-itoh@jp.fujitsu.com>2014-04-09 09:18:04 +0900
committerChris Mason <clm@fb.com>2014-06-09 17:20:42 -0700
commit59885b39303edc0b3284f324a1ca42cb6e7742d0 (patch)
tree0e04e1c1fc5b0c32407c46ade6548c49e10b42c3 /fs/btrfs/disk-io.c
parent776e4aae5508848730a82b4695edfbd7bc802c33 (diff)
downloadop-kernel-dev-59885b39303edc0b3284f324a1ca42cb6e7742d0.zip
op-kernel-dev-59885b39303edc0b3284f324a1ca42cb6e7742d0.tar.gz
Btrfs: fix possible memory leak in btrfs_create_tree()
In btrfs_create_tree(), if btrfs_insert_root() fails, we should free root->commit_root. Reported-by: Alex Lyakas <alex@zadarastorage.com> Signed-off-by: Tsutomu Itoh <t-itoh@jp.fujitsu.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index cf8427a..d3bd34e 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1366,6 +1366,7 @@ struct btrfs_root *btrfs_create_tree(struct btrfs_trans_handle *trans,
fail:
if (leaf) {
btrfs_tree_unlock(leaf);
+ free_extent_buffer(root->commit_root);
free_extent_buffer(leaf);
}
kfree(root);
OpenPOWER on IntegriCloud