diff options
author | Qinglang Miao <miaoqinglang@huawei.com> | 2021-01-15 10:22:50 +0800 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2021-01-22 16:35:34 +0100 |
commit | 67e40054de86aae520ddc2a072d7f6951812a14f (patch) | |
tree | db832bf515b3c0f19325d302c3ea21fe9669f7b3 /drivers | |
parent | 19c329f6808995b142b3966301f217c831e7cf31 (diff) | |
download | linux-stable-67e40054de86aae520ddc2a072d7f6951812a14f.tar.gz linux-stable-67e40054de86aae520ddc2a072d7f6951812a14f.tar.bz2 linux-stable-67e40054de86aae520ddc2a072d7f6951812a14f.zip |
ACPI: configfs: add missing check after configfs_register_default_group()
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>
Suggested-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Cc: 4.10+ <stable@vger.kernel.org> # 4.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/acpi/acpi_configfs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/acpi/acpi_configfs.c b/drivers/acpi/acpi_configfs.c index cf91f49101ea..3a14859dbb75 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_unregister_subsystem(&acpi_configfs); + return PTR_ERR(acpi_table_group); + } + + return 0; } module_init(acpi_configfs_init); |