Commit 19bcbb70 authored by Wang ShaoBo's avatar Wang ShaoBo Committed by Jialin Zhang
Browse files

arm64/mpam: fix missing kfree domain's ctrl_val arrray

hulk inclusion
category: bugfix
bugzilla: 187154, https://gitee.com/openeuler/kernel/issues/I7M52S


CVE: NA

--------------------------------

Fix mpam memleak issue found by kmemleak:
unreferenced object 0xffff204000d1d000 (size 128):
  comm "cpuhp/24", pid 132, jiffies 4294896121 (age 146328.256s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<00000000dd76fed3>] __kmalloc+0x478/0x664
    [<00000000e2fa4b32>] mpam_resctrl_setup_domain+0x290/0x5d0
    [<0000000088adc589>] mpam_resctrl_cpu_online+0x14c/0x1d0
    [<00000000b223bfaa>] mpam_cpu_online+0x1c8/0x2e4
    [<000000004438534a>] cpuhp_invoke_callback+0x1f4/0x11b0
    [<0000000049ede841>] cpuhp_thread_fun+0x2b8/0x510
    [<000000000d731c73>] smpboot_thread_fn+0x260/0x5a0
    [<0000000093c61bad>] kthread+0x27c/0x350
    [<00000000379f0572>] ret_from_fork+0x10/0x18

There are two cases causing memleak:
1. When offline all cpus of a domain in mpam_resctrl_cpu_offline(),
we only free domain's space but not the space of ctrl_val array.
2. When allocating ctrl_val array failed in mpam_resctrl_setup_domain(),
the space of ctrl_val array may not be freed.

Fixes: e1ff5fac ("arm64/mpam: resctrl: Handle cpuhp and resctrl_dom allocation")
Signed-off-by: default avatarWang ShaoBo <bobo.shaobowang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parent af481f24
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment