]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
platform/x86: dell-wmi-sysman: Make it safe to call exit_foo_attributes() multiple...
authorHans de Goede <hdegoede@redhat.com>
Sun, 21 Mar 2021 11:58:57 +0000 (12:58 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:30:25 +0000 (14:30 +0200)
commit2e6468ac29b4c79f14fb9c2a4c8dae90e223a665
tree321b3b6037fcb352b33a5cc6a9352c7a2ec1b01a
parent2286f9404b01c65d3a7f37f401ca3e92e25c5ad2
platform/x86: dell-wmi-sysman: Make it safe to call exit_foo_attributes() multiple times

[ Upstream commit 2d0c418c91d8c86a1b9fb254dda842ada9919513 ]

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 <Divya_Bharathi@dell.com>
Cc: Mario Limonciello <mario.limonciello@dell.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20210321115901.35072-4-hdegoede@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/platform/x86/dell-wmi-sysman/enum-attributes.c
drivers/platform/x86/dell-wmi-sysman/int-attributes.c
drivers/platform/x86/dell-wmi-sysman/passobj-attributes.c
drivers/platform/x86/dell-wmi-sysman/string-attributes.c