summaryrefslogtreecommitdiff
path: root/volumes.c
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-02-25 16:54:38 -0600
committerDavid Sterba <dsterba@suse.cz>2013-02-27 14:39:31 +0100
commitbbf1919b007c7d7ca88bce2cda500a403cfa7a7e (patch)
tree0742c430b383dc1e3e21032ecbd0fb14bd1565f2 /volumes.c
parentb808cb66aa7e68bfadfc73f8e5191d284413e3d1 (diff)
btrfs-progs: avoid double-free in __btrfs_map_block
__btrfs_map_block() can possibly do the goto again: loop after having allocated & freed the "multi" pointer. There are then a couple error conditions where it will attempt to again kfree the now non-NULL multi pointer. So before retrying, reset multi to NULL after we free it. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/volumes.c b/volumes.c
index c8fbde3d..ca1b4025 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1226,6 +1226,7 @@ again:
if (multi_ret && stripes_allocated < stripes_required) {
stripes_allocated = stripes_required;
kfree(multi);
+ multi = NULL;
goto again;
}
stripe_nr = offset;