Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1171042
| Path | csiph.com!aioe.org!news.lightlink.com!newsfeed1.swip.net!newsreader4.netcologne.de!news.netcologne.de!weretis.net!feeder4.news.weretis.net!storethat.news.telefonica.de!telefonica.de!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Tejun Heo <tj@kernel.org> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/7] blkcg: use blkg_free() in blkcg_init_queue() failure path |
| Date | Wed, 24 Jun 2015 04:50:03 +0200 |
| Message-ID | <pEIVd-554-47@gated-at.bofh.it> (permalink) |
| References | <pEIVb-554-13@gated-at.bofh.it> |
| X-Original-To | axboe@kernel.dk |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=G75LPLzg5g8AbQwMleS+XMITmvuAVP+js4TEsar9hww=; b=AklpLIT5ZdDdpVV/SyUhu1uObcA5nFk/i4ILv7XPC+1zGeG0klQbxPDGnO/UNSTrAK 7/xCvyggUydG5pAuL7J4S3MFAxc91OioTXIUussR92DFmKi7A9VZQQQAuKwxQZNFRdit IMWFwgb+KAYAy0G8/CFgBuCEWsuz2AsOFjDr/LieIE4oA+UW6SweC8fQV5qvoDtdvf2h JH3QqcX63UyLBaP2D7XjERX0ILh/IKP6f4XP49cXT/unYJcepF51KZ/qJKIsnrdR1l+r NnwEYzDCDLU44wnmtckj96LOAGk+hPgC823l9egNAX3jjw1Co2s9kywNG5PgHtQ4fE1q jSWg== |
| X-Received | by 10.55.23.144 with SMTP id 16mr57088674qkx.97.1435113859004; Tue, 23 Jun 2015 19:44:19 -0700 (PDT) |
| X-Mailer | git-send-email 2.4.3 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 46 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, vgoyal@redhat.com, avanzini.arianna@gmail.com, kernel-team@fb.com, Tejun Heo <tj@kernel.org> |
| X-Original-Date | Tue, 23 Jun 2015 22:44:08 -0400 |
| X-Original-Message-ID | <1435113853-12053-3-git-send-email-tj@kernel.org> |
| X-Original-References | <1435113853-12053-1-git-send-email-tj@kernel.org> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | aioe.org linux.kernel:1171042 |
Show key headers only | View raw
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: Tejun Heo <tj@kernel.org>
Cc: Vivek Goyal <vgoyal@redhat.com>
---
block/blk-cgroup.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 1fddbbd..898f560 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -57,7 +57,8 @@ static void blkg_free(struct blkcg_gq *blkg)
for (i = 0; i < BLKCG_MAX_POLS; i++)
kfree(blkg->pd[i]);
- blk_exit_rl(&blkg->rl);
+ if (blkg->blkcg != &blkcg_root)
+ blk_exit_rl(&blkg->rl);
kfree(blkg);
}
@@ -886,7 +887,7 @@ int blkcg_init_queue(struct request_queue *q)
radix_tree_preload_end();
if (IS_ERR(blkg)) {
- kfree(new_blkg);
+ blkg_free(new_blkg);
return PTR_ERR(blkg);
}
--
2.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 2/7] blkcg: use blkg_free() in blkcg_init_queue() failure path Tejun Heo <tj@kernel.org> - 2015-06-24 04:50 +0200
csiph-web