提交 0f3aeca9 编写于 作者: H Hanjun Guo 提交者: Yang Yingliang

irqchip/gicv3: Call acpi_put_table() to fix memory leak

hulk inclusion
category: bugfix
bugzilla: NA
CVE: NA

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

With check_early_ioremap_leak(), we got warning:

[    2.599829] ------------[ cut here ]------------
[    2.604436] Debug warning: early ioremap leak of 1 areas detected.
[    2.604436] please boot with early_ioremap_debug and report the
dmesg.
[    2.617135] WARNING: CPU: 0 PID: 1 at mm/early_ioremap.c:99
check_early_ioremap_leak+0x4c/0x60
[    2.625731] Modules linked in:
[    2.628775] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.90+ #32
[    2.634941] Hardware name: Huawei D06 /D06, BIOS Hisilicon D06 UEFI
RC0 - V1.16.01 03/15/2019
[    2.643451] pstate: 60c00009 (nZCv daif +PAN +UAO)
[    2.648229] pc : check_early_ioremap_leak+0x4c/0x60
[    2.653093] lr : check_early_ioremap_leak+0x4c/0x60
[    2.657956] sp : ffff00008222fd90
[    2.661257] x29: ffff00008222fd90 x28: ffff000080f41070
[    2.666555] x27: ffff000080e507b0 x26: ffff000081480000
[    2.671854] x25: 0000000000000008 x24: 0000000000000007
[    2.677152] x23: ffff000080e3ae58 x22: ffff000081480000
[    2.682450] x21: 0000000000000000 x20: ffff000080e811b0
[    2.687748] x19: ffff0000812f3000 x18: ffffffffffffffff
[    2.693046] x17: 000000008c2a0cd7 x16: 00000000e2c72cdd
[    2.698344] x15: ffff0000812f3708 x14: 00017
[    2.724834] x5 : 000000000000000f x4 : 0000000000000000
[    2.730132] x3 : 0000000000000000 x2 : ffffffffffffffff
[    2.735430] x1 : 612b3b9664d69500 x0 : 0000000000000000
[    2.740729] Call trace:
[    2.743163]  check_early_ioremap_leak+0x4c/0x60
[    2.747681]  do_one_initcall+0x54/0x200
[    2.751504]  kernel_init_freeable+0x2a0/0x34c
[    2.755849]  kernel_init+0x18/0x118
[    2.759324]  ret_from_fork+0x10/0x18
[    2.762887] ---[ end trace a57e2a42868dc894 ]---

adding early_ioremap_debug=1 in boot cmdline,

[    0.000000] ------------[ cut here ]------------
[    0.000000] __early_ioremap(396f0000, 00010000) [1] => 00000000 +
ffff7fdffe620000
[    0.000000] WARNING: CPU: 0 PID: 0 at mm/early_ioremap.c:162
__early_ioremap+0x18c/0x1c8
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W
4.19.90+ #31
[    0.000000] pstate: 60000089 (nZCv daIf -PAN -UAO)
[    0.000000] pc : __early_ioremap+0x18c/0x1c8
[    0.000000] lr : __early_ioremap+0x18c/0x1c8
[    0.000000] sp : ffff0000812afc00
[    0.000000] x29: ffff0000812afc00 x28: ffff000080f2c878
[    0.000000] x27: 0000000000000000 x26: 0000000000000001
[    0.000000] x25: 0068000000000713 x24: 00000000396e0000
[    0.000000] x23: 0000000000000001 x22: 0000000000000000
[    0.000000] x21: 0000000000010000 x20: 00000000396f0000
[    0.000000] x19: ffff000080f2c000 x18: ffffffffffffffff
[    0.000000] x17: 0000000000000000 x16: 0000000000000000
[    0.000000] x15: ffff0000812d3708 x14: 3030323665666664
[    0.000000] x13: 663766666666202b x12: 2030303030303030
[    0.000000] x11: 30203e3d205d315b x10: 2029303030303130
[    0.000000] x9 : 3030202c30303030 x8 : 0000000000001181
[    0.000000] x7 : 65726f695f796c72 x6 : ffff0000814ec9ed
[    0.000000] x5 : 0000000000000000 x4 : 0000000000000000
[    0.000000] x3 : 0000000000000000 x2 : ffffffffffffffff
[    0.000000] x1 : ed48fa59d999c400 x0 : 0000000000000000
[    0.000000] Call trace:
[    0.000000]  __early_ioremap+0x18c/0x1c8
[    0.000000]  early_memremap+0x7c/0x88
[    0.000000]  __acpi_map_table+0x2c/0x40
[    0.000000]  acpi_os_map_iomem+0x134/0x208
[    0.000000]  acpi_os_map_memory+0x28/0x38
[    0.000000]  acpi_tb_acquire_table+0x58/0x8c
[    0.000000]  acpi_tb_validate_table+0x34/0x58
[    0.000000]  acpi_tb_get_table+0x4c/0x90
[    0.000000]  acpi_get_table+0x94/0xc4
[    0.000000]  acpi_table_parse_entries_array+0x98/0x224
[    0.000000]  acpi_table_parse_entries+0x70/0x98
[    0.000000]  acpi_table_parse_madt+0x40/0x50
[    0.000000]  __acpi_probe_device_table+0x90/0xf0
[    0.000000]  irqchip_init+0x38/0x40
[    0.000000]  init_IRQ+0x10c/0x140
[    0.000000]  start_kernel+0x35c/0x4fc
[    0.000000] ---[ end trace f68728a0d3053bc0 ]---

It turns out that we missed the acpi_put_table() after get the
table, fix it.
Reported-by: NChao Gao <gaochao24@huawei.com>
Signed-off-by: NHanjun Guo <guohanjun@huawei.com>
Reviewed-by: NXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 6229fd43
...@@ -940,6 +940,8 @@ static void gic_check_hisi_workaround(void) ...@@ -940,6 +940,8 @@ static void gic_check_hisi_workaround(void)
break; break;
} }
} }
acpi_put_table(tbl);
} }
static void gic_compute_nr_gicr(void) static void gic_compute_nr_gicr(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册