Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752585AbbGOPwq (ORCPT ); Wed, 15 Jul 2015 11:52:46 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:45267 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751895AbbGOPwp (ORCPT ); Wed, 15 Jul 2015 11:52:45 -0400 From: Andrey Vagin To: linux-kernel@vger.kernel.org Cc: Andrey Vagin Subject: [PATCH] blk-cgroup: don't leak blkcg->pd elements Date: Wed, 15 Jul 2015 18:52:22 +0300 Message-Id: <1436975542-24807-1-git-send-email-avagin@openvz.org> X-Mailer: git-send-email 2.1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1772 Lines: 49 They are allocated in blkcg_css_alloc(). This bug is reported by the kmemleak subsystem: unreferenced object 0xffff88007d004d60 (size 32): comm "systemd", pid 1, jiffies 4294668449 (age 34.455s) hex dump (first 32 bytes): 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 f4 01 00 00 f4 01 00 00 ................ backtrace: [] kmemleak_alloc+0x4e/0xb0 [] __kmalloc+0x1e4/0x290 [] blkcg_css_alloc+0x6d/0x120 [] create_css+0x44/0x220 [] cgroup_mkdir+0x220/0x2c0 [] kernfs_iop_mkdir+0x5a/0x80 [] vfs_mkdir+0xbb/0x150 [] SyS_mkdir+0x7a/0xe0 [] entry_SYSCALL_64_fastpath+0x12/0x71 [] 0xffffffffffffffff Fixes: e48453c386f3 ('block, cgroup: implement policy-specific per-blkcg data') Signed-off-by: Andrey Vagin --- block/blk-cgroup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 9f97da5..aa04821 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -821,6 +821,10 @@ static void blkcg_css_offline(struct cgroup_subsys_state *css) static void blkcg_css_free(struct cgroup_subsys_state *css) { struct blkcg *blkcg = css_to_blkcg(css); + int i; + + for (i = 0; i < BLKCG_MAX_POLS ; i++) + kfree(blkcg->pd[i]); if (blkcg != &blkcg_root) kfree(blkcg); -- 2.1.0 -- 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/