From 2191fc0f29b2d4e8e3e4aa5bf75df771aa7b1f88 Mon Sep 17 00:00:00 2001 From: Hou Tao Date: Fri, 3 Feb 2017 17:19:07 +0800 Subject: [PATCH] blkcg: fix double free of new_blkg in blkcg_init_queue [ 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 Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/blk-cgroup.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 7104d9e1b5f9a..4d1cc69825183 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -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; -- 2.47.2