blkcg: fix double free of new_blkg in blkcg_init_queue
authorHou Tao <houtao1@huawei.com>
Fri, 3 Feb 2017 09:19:07 +0000 (17:19 +0800)
committerJens Axboe <axboe@fb.com>
Fri, 3 Feb 2017 14:52:35 +0000 (07:52 -0700)
If blkg_create fails, new_blkg passed as an argument will
be freed by blkg_create, so there is no need to free it again.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
block/blk-cgroup.c

index 37fe595cfd700c24e07cc477f3eb7bdf48bb1a21..295e98c2c8ccdf7c86515306157d620c83052119 100644 (file)
@@ -1079,10 +1079,8 @@ int blkcg_init_queue(struct request_queue *q)
        if (preloaded)
                radix_tree_preload_end();
 
-       if (IS_ERR(blkg)) {
-               blkg_free(new_blkg);
+       if (IS_ERR(blkg))
                return PTR_ERR(blkg);
-       }
 
        q->root_blkg = blkg;
        q->root_rl.blkg = blkg;