From: Hou Tao Date: Fri, 3 Feb 2017 09:19:07 +0000 (+0800) Subject: blkcg: fix double free of new_blkg in blkcg_init_queue X-Git-Tag: v4.4.123~130 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=633a5a5235d697b145171ca1e702d3a4f6778131;p=thirdparty%2Fkernel%2Fstable.git blkcg: fix double free of new_blkg in blkcg_init_queue commit 9b54d816e00425c3a517514e0d677bb3cec49258 upstream. 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 Cc: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 8161090a19708..46ba2402c8f97 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1078,10 +1078,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;