diff options
| author | Hans de Goede <[email protected]> | 2021-03-21 11:58:57 +0000 |
|---|---|---|
| committer | Hans de Goede <[email protected]> | 2021-03-21 16:47:08 +0000 |
| commit | 2d0c418c91d8c86a1b9fb254dda842ada9919513 (patch) | |
| tree | c02424d784feaea892891dfa8e121335666c4b5e /drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c | |
| parent | platform/x86: dell-wmi-sysman: Fix possible NULL pointer deref on exit (diff) | |
| download | kernel-2d0c418c91d8c86a1b9fb254dda842ada9919513.tar.gz kernel-2d0c418c91d8c86a1b9fb254dda842ada9919513.zip | |
platform/x86: dell-wmi-sysman: Make it safe to call exit_foo_attributes() multiple times
During some of the error-exit paths it is possible that
release_attributes_data() will get called multiple times,
which results in exit_foo_attributes() getting called multiple
times.
Make it safe to call exit_foo_attributes() multiple times,
avoiding double-free()s in this case.
Note that release_attributes_data() really should only be called
once during error-exit paths. This will be fixed in a separate patch
and it is good to have the exit_foo_attributes() functions modified
this way regardless.
Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
Cc: Divya Bharathi <[email protected]>
Cc: Mario Limonciello <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c')
| -rw-r--r-- | drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c b/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c index 80f4b7785c6c..091e48c217ed 100644 --- a/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c +++ b/drivers/platform/x86/dell/dell-wmi-sysman/enum-attributes.c @@ -185,5 +185,8 @@ void exit_enum_attributes(void) sysfs_remove_group(wmi_priv.enumeration_data[instance_id].attr_name_kobj, &enumeration_attr_group); } + wmi_priv.enumeration_instances_count = 0; + kfree(wmi_priv.enumeration_data); + wmi_priv.enumeration_data = NULL; } |
