Commit 994b7832 authored by Tejun Heo's avatar Tejun Heo Committed by Jens Axboe

blkcg: use blkg_free() in blkcg_init_queue() failure path

When blkcg_init_queue() fails midway after creating a new blkg, it
performs kfree() directly; however, this doesn't free the policy data
areas.  Make it use blkg_free() instead.  In turn, blkg_free() is
updated to handle root request_list special case.

While this fixes a possible memory leak, it's on an unlikely failure
path of an already cold path and the size leaked per occurrence is
miniscule too.  I don't think it needs to be tagged for -stable.
Signed-off-by: default avatarTejun Heo <>
Cc: Vivek Goyal <>
Signed-off-by: default avatarJens Axboe <>
parent 401efbf8
......@@ -70,7 +70,8 @@ static void blkg_free(struct blkcg_gq *blkg)
for (i = 0; i < BLKCG_MAX_POLS; i++)
if (blkg->blkcg != &blkcg_root)
......@@ -938,7 +939,7 @@ int blkcg_init_queue(struct request_queue *q)
if (IS_ERR(blkg)) {
return PTR_ERR(blkg);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment