lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 15 Jul 2015 18:52:22 +0300
From:	Andrey Vagin <avagin@...nvz.org>
To:	linux-kernel@...r.kernel.org
Cc:	Andrey Vagin <avagin@...nvz.org>
Subject: [PATCH] blk-cgroup: don't leak blkcg->pd elements

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:
    [<ffffffff816ce9ce>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff811baf94>] __kmalloc+0x1e4/0x290
    [<ffffffff8133eb5d>] blkcg_css_alloc+0x6d/0x120
    [<ffffffff81108124>] create_css+0x44/0x220
    [<ffffffff8110bcf0>] cgroup_mkdir+0x220/0x2c0
    [<ffffffff812513fa>] kernfs_iop_mkdir+0x5a/0x80
    [<ffffffff811dfddb>] vfs_mkdir+0xbb/0x150
    [<ffffffff811e50ea>] SyS_mkdir+0x7a/0xe0
    [<ffffffff816d822e>] entry_SYSCALL_64_fastpath+0x12/0x71
    [<ffffffffffffffff>] 0xffffffffffffffff

Fixes: e48453c386f3 ('block, cgroup: implement policy-specific per-blkcg data')
Signed-off-by: Andrey Vagin <avagin@...nvz.org>
---
 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ