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)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 21 Mar 2018 03:49:54 +0000 (23:49 -0400)
[ Upstream commit 9b54d816e00425c3a517514e0d677bb3cec49258 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
block/blk-cgroup.c

index 7104d9e1b5f9a76fb65f352f2923e55733bb7474..4d1cc698251835c5a5bf5d84cc3945a1279ceb86 100644 (file)
@@ -870,10 +870,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;