btrfs-progs: avoid double-free in __btrfs_map_block
authorEric Sandeen <sandeen@redhat.com>
Mon, 25 Feb 2013 22:54:38 +0000 (16:54 -0600)
committerDavid Sterba <dsterba@suse.cz>
Wed, 27 Feb 2013 13:39:31 +0000 (14:39 +0100)
__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>
volumes.c

index c8fbde3..ca1b402 100644 (file)
--- 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;