* [PATCH] ACPI: configfs: add missing check after configfs_register_default_group
@ 2021-01-13 7:30 Qinglang Miao
2021-01-13 8:32 ` Hanjun Guo
0 siblings, 1 reply; 2+ messages in thread
From: Qinglang Miao @ 2021-01-13 7:30 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel, Qinglang Miao
A list_add corruption is reported by Hulk Robot like this:
==============
list_add corruption.
Call Trace:
link_obj+0xc0/0x1c0
link_group+0x21/0x140
configfs_register_subsystem+0xdb/0x380
acpi_configfs_init+0x25/0x1000 [acpi_configfs]
do_one_initcall+0x149/0x820
do_init_module+0x1ef/0x720
load_module+0x35c8/0x4380
__do_sys_finit_module+0x10d/0x1a0
do_syscall_64+0x34/0x80
It's because of the missing check after configfs_register_default_group,
where configfs_unregister_subsystem should be called once failure.
Fixes: 612bd01fc6e0 ("ACPI: add support for loading SSDTs via configfs")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
---
drivers/acpi/acpi_configfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
index cf91f4910..25512ab0e 100644
--- a/drivers/acpi/acpi_configfs.c
+++ b/drivers/acpi/acpi_configfs.c
@@ -268,7 +268,12 @@ static int __init acpi_configfs_init(void)
acpi_table_group = configfs_register_default_group(root, "table",
&acpi_tables_type);
- return PTR_ERR_OR_ZERO(acpi_table_group);
+ if (IS_ERR(acpi_table_group)) {
+ configfs_register_subsystem(&acpi_configfs);
+ return PTR_ERR(acpi_table_group);
+ }
+
+ return 0;
}
module_init(acpi_configfs_init);
--
2.23.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ACPI: configfs: add missing check after configfs_register_default_group
2021-01-13 7:30 [PATCH] ACPI: configfs: add missing check after configfs_register_default_group Qinglang Miao
@ 2021-01-13 8:32 ` Hanjun Guo
0 siblings, 0 replies; 2+ messages in thread
From: Hanjun Guo @ 2021-01-13 8:32 UTC (permalink / raw)
To: Qinglang Miao, Rafael J. Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel
On 2021/1/13 15:30, Qinglang Miao wrote:
> A list_add corruption is reported by Hulk Robot like this:
> ==============
> list_add corruption.
> Call Trace:
> link_obj+0xc0/0x1c0
> link_group+0x21/0x140
> configfs_register_subsystem+0xdb/0x380
> acpi_configfs_init+0x25/0x1000 [acpi_configfs]
> do_one_initcall+0x149/0x820
> do_init_module+0x1ef/0x720
> load_module+0x35c8/0x4380
> __do_sys_finit_module+0x10d/0x1a0
> do_syscall_64+0x34/0x80
>
> It's because of the missing check after configfs_register_default_group,
> where configfs_unregister_subsystem should be called once failure.
I think it's right to call *_unregister_* for error path, but...
>
> Fixes: 612bd01fc6e0 ("ACPI: add support for loading SSDTs via configfs")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
> ---
> drivers/acpi/acpi_configfs.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c
> index cf91f4910..25512ab0e 100644
> --- a/drivers/acpi/acpi_configfs.c
> +++ b/drivers/acpi/acpi_configfs.c
> @@ -268,7 +268,12 @@ static int __init acpi_configfs_init(void)
>
> acpi_table_group = configfs_register_default_group(root, "table",
> &acpi_tables_type);
> - return PTR_ERR_OR_ZERO(acpi_table_group);
> + if (IS_ERR(acpi_table_group)) {
> + configfs_register_subsystem(&acpi_configfs);
...
Typo here, s/register/unregister.
Thanks
Hanjun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-13 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 7:30 [PATCH] ACPI: configfs: add missing check after configfs_register_default_group Qinglang Miao
2021-01-13 8:32 ` Hanjun Guo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).