Skip to content

Commit 2deb10a

Browse files
mrhpearsongregkh
authored andcommitted
platform/x86: think-lmi: Fix password opcode ordering for workstations
[ Upstream commit 6f7d0f5 ] The Lenovo workstations require the password opcode to be run before the attribute value is changed (if Admin password is enabled). Tested on some Thinkpads to confirm they are OK with this order too. Signed-off-by: Mark Pearson <[email protected]> Fixes: 640a5fa ("platform/x86: think-lmi: Opcode support") Reviewed-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]> (cherry picked from commit 6f7d0f5) [Harshit: CVE-2024-26836; Resolve conflicts due to missing commit: 318d978 ("platform/x86: think-lmi: Add bulk save feature") which is not in 6.6.y] Signed-off-by: Harshit Mogalapalli <[email protected]> Signed-off-by: Vegard Nossum <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e115c1b commit 2deb10a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

drivers/platform/x86/think-lmi.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,16 @@ static ssize_t current_value_store(struct kobject *kobj,
10211021
* Note - this sets the variable and then the password as separate
10221022
* WMI calls. Function tlmi_save_bios_settings will error if the
10231023
* password is incorrect.
1024+
* Workstation's require the opcode to be set before changing the
1025+
* attribute.
10241026
*/
1027+
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
1028+
ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
1029+
tlmi_priv.pwd_admin->password);
1030+
if (ret)
1031+
goto out;
1032+
}
1033+
10251034
set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name,
10261035
new_setting);
10271036
if (!set_str) {
@@ -1033,13 +1042,6 @@ static ssize_t current_value_store(struct kobject *kobj,
10331042
if (ret)
10341043
goto out;
10351044

1036-
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
1037-
ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
1038-
tlmi_priv.pwd_admin->password);
1039-
if (ret)
1040-
goto out;
1041-
}
1042-
10431045
ret = tlmi_save_bios_settings("");
10441046
} else { /* old non-opcode based authentication method (deprecated) */
10451047
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {

0 commit comments

Comments
 (0)