Skip to content

Commit 6f7d0f5

Browse files
mrhpearsonjwrdegoede
authored andcommitted
platform/x86: think-lmi: Fix password opcode ordering for workstations
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 <mpearson-lenovo@squebb.ca> Fixes: 640a5fa ("platform/x86: think-lmi: Opcode support") Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240209152359.528919-1-mpearson-lenovo@squebb.ca Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
1 parent 1abdf28 commit 6f7d0f5

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

drivers/platform/x86/think-lmi.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,16 @@ static ssize_t current_value_store(struct kobject *kobj,
10091009
* Note - this sets the variable and then the password as separate
10101010
* WMI calls. Function tlmi_save_bios_settings will error if the
10111011
* password is incorrect.
1012+
* Workstation's require the opcode to be set before changing the
1013+
* attribute.
10121014
*/
1015+
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
1016+
ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
1017+
tlmi_priv.pwd_admin->password);
1018+
if (ret)
1019+
goto out;
1020+
}
1021+
10131022
set_str = kasprintf(GFP_KERNEL, "%s,%s;", setting->display_name,
10141023
new_setting);
10151024
if (!set_str) {
@@ -1021,17 +1030,10 @@ static ssize_t current_value_store(struct kobject *kobj,
10211030
if (ret)
10221031
goto out;
10231032

1024-
if (tlmi_priv.save_mode == TLMI_SAVE_BULK) {
1033+
if (tlmi_priv.save_mode == TLMI_SAVE_BULK)
10251034
tlmi_priv.save_required = true;
1026-
} else {
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-
}
1035+
else
10331036
ret = tlmi_save_bios_settings("");
1034-
}
10351037
} else { /* old non-opcode based authentication method (deprecated) */
10361038
if (tlmi_priv.pwd_admin->valid && tlmi_priv.pwd_admin->password[0]) {
10371039
auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",

0 commit comments

Comments
 (0)