Messages in this thread Patch in this message | | | From | Andrey Vagin <> | Subject | [PATCH] blk-cgroup: don't leak blkcg->pd elements | Date | Wed, 15 Jul 2015 18:52:22 +0300 |
| |
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@openvz.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
| |