lkml.org 
[lkml]   [2015]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] blk-cgroup: don't leak blkcg->pd elements
I haven't checked the patch correctness but just noticed that the
block maintainer and author of the fixed commit are not cc'ed.

Catalin

On 15 July 2015 at 16:52, Andrey Vagin <avagin@openvz.org> wrote:
> 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
>
> --
> 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/


\
 
 \ /
  Last update: 2015-07-15 19:01    [W:0.063 / U:0.828 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site