Commit ffc17e14 authored by Aleksandr Mishin's avatar Aleksandr Mishin Committed by Ilpo Järvinen

platform/x86: dell-smbios: Fix error path in dell_smbios_init()

In case of error in build_tokens_sysfs(), all the memory that has been
allocated is freed at end of this function. But then free_group() is
called which performs memory deallocation again.

Also, instead of free_group() call, there should be exit_dell_smbios_smm()
and exit_dell_smbios_wmi() calls, since there is initialization, but there
is no release of resources in case of an error.

Fix these issues by replacing free_group() call with
exit_dell_smbios_wmi() and exit_dell_smbios_smm().

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 33b9ca1e ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens")
Signed-off-by: default avatarAleksandr Mishin <amishin@t-argos.ru>
Link: https://lore.kernel.org/r/20240830065428.9544-1-amishin@t-argos.ruReviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
parent a3379eca
......@@ -622,7 +622,10 @@ static int __init dell_smbios_init(void)
return 0;
fail_sysfs:
free_group(platform_device);
if (!wmi)
exit_dell_smbios_wmi();
if (!smm)
exit_dell_smbios_smm();
fail_create_group:
platform_device_del(platform_device);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment