summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAleksandr Mishin <amishin@t-argos.ru>2024-08-30 09:54:28 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-12 11:10:21 +0200
commit942baec8d1ad1284ac9e6bd48194d77769a1d7e6 (patch)
tree16dfd2519da847115017998834b931e1fba9cba4 /drivers
parent9e3ffb839249eca113062587659224f856fe14e5 (diff)
downloadlinux-942baec8d1ad1284ac9e6bd48194d77769a1d7e6.tar.gz
linux-942baec8d1ad1284ac9e6bd48194d77769a1d7e6.tar.bz2
linux-942baec8d1ad1284ac9e6bd48194d77769a1d7e6.zip
platform/x86: dell-smbios: Fix error path in dell_smbios_init()
[ Upstream commit ffc17e1479e8e9459b7afa80e5d9d40d0dd78abb ] 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: 33b9ca1e53b4 ("platform/x86: dell-smbios: Add a sysfs interface for SMBIOS tokens") Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru> Link: https://lore.kernel.org/r/20240830065428.9544-1-amishin@t-argos.ru Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/x86/dell/dell-smbios-base.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/platform/x86/dell/dell-smbios-base.c b/drivers/platform/x86/dell/dell-smbios-base.c
index 86b95206cb1b..6fb538a13868 100644
--- a/drivers/platform/x86/dell/dell-smbios-base.c
+++ b/drivers/platform/x86/dell/dell-smbios-base.c
@@ -590,7 +590,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);