42f38dcc | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
platform/x86: dell-wmi-sysman: Cleanup create_attributes_level_sysfs_files()
Cleanup create_attributes_level_sysfs_files():
1. There is no need to call sysfs_remove_file() on error, sysman_init() w
platform/x86: dell-wmi-sysman: Cleanup create_attributes_level_sysfs_files()
Cleanup create_attributes_level_sysfs_files():
1. There is no need to call sysfs_remove_file() on error, sysman_init() will already call release_attributes_data() on failure which already does this.
2. There is no need for the pr_debug() calls sysfs_create_file() should never fail and if it does it will already complain about the problem itself.
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-8-hdegoede@redhat.com
show more ...
|
9b95665a | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
platform/x86: dell-wmi-sysman: Make sysman_init() return -ENODEV of the interfaces are not found
When either the attributes or the password interface is not found, then unregister the 2 wmi drivers
platform/x86: dell-wmi-sysman: Make sysman_init() return -ENODEV of the interfaces are not found
When either the attributes or the password interface is not found, then unregister the 2 wmi drivers again and return -ENODEV from sysman_init().
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> Reported-by: Alexander Naumann <alexandernaumann@gmx.de> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210321115901.35072-7-hdegoede@redhat.com
show more ...
|
eaa1dcc7 | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
platform/x86: dell-wmi-sysman: Cleanup sysman_init() error-exit handling
Cleanup sysman_init() error-exit handling:
1. There is no need for the fail_reset_bios and fail_authentication_kset eror-
platform/x86: dell-wmi-sysman: Cleanup sysman_init() error-exit handling
Cleanup sysman_init() error-exit handling:
1. There is no need for the fail_reset_bios and fail_authentication_kset eror-exit cases, these can be handled by release_attributes_data()
2. Rename all the labels from fail_what_failed, to err_what_to_cleanup this is the usual way to name these and avoids the need to rename them when extra steps are added.
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-6-hdegoede@redhat.com
show more ...
|
f4c4e9ad | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
platform/x86: dell-wmi-sysman: Fix release_attributes_data() getting called twice on init_bios_attributes() failure
All calls of init_bios_attributes() will result in a goto fail_create_group if the
platform/x86: dell-wmi-sysman: Fix release_attributes_data() getting called twice on init_bios_attributes() failure
All calls of init_bios_attributes() will result in a goto fail_create_group if they fail, which calls release_attributes_data().
So there is no need to call release_attributes_data() from init_bios_attributes() on failure itself.
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-5-hdegoede@redhat.com
show more ...
|
cb1e50f2 | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
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 ti
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 <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
show more ...
|
ececdb89 | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
platform/x86: dell-wmi-sysman: Fix possible NULL pointer deref on exit
It is possible for release_attributes_data() to get called when the main_dir_kset has not been created yet, move the removal of
platform/x86: dell-wmi-sysman: Fix possible NULL pointer deref on exit
It is possible for release_attributes_data() to get called when the main_dir_kset has not been created yet, move the removal of the bios-reset sysfs attr to under a if (main_dir_kset) check to avoid a NULL pointer deref.
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> Reported-by: Alexander Naumann <alexandernaumann@gmx.de> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20210321115901.35072-3-hdegoede@redhat.com
show more ...
|
bdda3967 | 21-Mar-2021 |
Hans de Goede <hdegoede@redhat.com> |
platform/x86: dell-wmi-sysman: Fix crash caused by calling kset_unregister twice
On some system the WMI GUIDs used by dell-wmi-sysman are present but there are no enum type attributes, this causes i
platform/x86: dell-wmi-sysman: Fix crash caused by calling kset_unregister twice
On some system the WMI GUIDs used by dell-wmi-sysman are present but there are no enum type attributes, this causes init_bios_attributes() to return -ENODEV, after which sysman_init() does a "goto fail_create_group" and then calls release_attributes_data().
release_attributes_data() calls kset_unregister(wmi_priv.main_dir_kset); but before this commit it was missing a "wmi_priv.main_dir_kset = NULL;" statement; and after calling release_attributes_data() the sysman_init() error handling does this:
if (wmi_priv.main_dir_kset) { kset_unregister(wmi_priv.main_dir_kset); wmi_priv.main_dir_kset = NULL; }
Which causes a second kset_unregister(wmi_priv.main_dir_kset), leading to a double-free, which causes a crash.
Add the missing "wmi_priv.main_dir_kset = NULL;" statement to release_attributes_data() to fix this double-free crash.
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-2-hdegoede@redhat.com
show more ...
|