[2/4] platform/x86: think-lmi: Correct System password interface

Message ID 20230517181945.3725-2-mpearson-lenovo@squebb.ca
State New
Headers
Series [1/4] platform/x86: think-lmi: Enable opcode support on BIOS settings |

Commit Message

Mark Pearson May 17, 2023, 6:19 p.m. UTC
  The system password identification was incorrect. This means that if
the password was enabled it wouldn't be detected correctly; and setting
it would not work.

Correct these mistakes.

Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
---
 drivers/platform/x86/think-lmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Hans de Goede May 23, 2023, 10:46 a.m. UTC | #1
Hi Mark,

On 5/17/23 20:19, Mark Pearson wrote:
> The system password identification was incorrect. This means that if
> the password was enabled it wouldn't be detected correctly; and setting
> it would not work.
> 
> Correct these mistakes.
> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
>  drivers/platform/x86/think-lmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index d9341305eba9..b8431d3b137f 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -171,7 +171,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support");
>  #define TLMI_POP_PWD (1 << 0)
>  #define TLMI_PAP_PWD (1 << 1)
>  #define TLMI_HDD_PWD (1 << 2)
> -#define TLMI_SYS_PWD (1 << 3)
> +#define TLMI_SYS_PWD (1 << 6)
>  #define TLMI_CERT    (1 << 7)
>  
>  #define to_tlmi_pwd_setting(kobj)  container_of(kobj, struct tlmi_pwd_setting, kobj)
> @@ -1504,7 +1504,7 @@ static int tlmi_analyze(void)
>  		tlmi_priv.pwd_power->valid = true;
>  
>  	if (tlmi_priv.opcode_support) {
> -		tlmi_priv.pwd_system = tlmi_create_auth("sys", "system");
> +		tlmi_priv.pwd_system = tlmi_create_auth("smp", "system");

"smp" ?

Also this is not explained in the commit message.

Regards,

Hans


>  		if (!tlmi_priv.pwd_system)
>  			goto fail_clear_attr;
>
  
Mark Pearson May 23, 2023, 12:43 p.m. UTC | #2
Thanks Hans

On Tue, May 23, 2023, at 6:46 AM, Hans de Goede wrote:
> Hi Mark,
>
> On 5/17/23 20:19, Mark Pearson wrote:
>> The system password identification was incorrect. This means that if
>> the password was enabled it wouldn't be detected correctly; and setting
>> it would not work.
>> 
>> Correct these mistakes.
>> 
>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>> ---
>>  drivers/platform/x86/think-lmi.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>> index d9341305eba9..b8431d3b137f 100644
>> --- a/drivers/platform/x86/think-lmi.c
>> +++ b/drivers/platform/x86/think-lmi.c
>> @@ -171,7 +171,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support");
>>  #define TLMI_POP_PWD (1 << 0)
>>  #define TLMI_PAP_PWD (1 << 1)
>>  #define TLMI_HDD_PWD (1 << 2)
>> -#define TLMI_SYS_PWD (1 << 3)
>> +#define TLMI_SYS_PWD (1 << 6)
>>  #define TLMI_CERT    (1 << 7)
>>  
>>  #define to_tlmi_pwd_setting(kobj)  container_of(kobj, struct tlmi_pwd_setting, kobj)
>> @@ -1504,7 +1504,7 @@ static int tlmi_analyze(void)
>>  		tlmi_priv.pwd_power->valid = true;
>>  
>>  	if (tlmi_priv.opcode_support) {
>> -		tlmi_priv.pwd_system = tlmi_create_auth("sys", "system");
>> +		tlmi_priv.pwd_system = tlmi_create_auth("smp", "system");
>
> "smp" ?

Yes - that is what is common across all the platforms.
https://docs.lenovocdrt.com/#/bios/wmi/wmi_guide?id=change-a-bios-password

I never quite got a straight answer on the origins of the 'sys' account - I think it may have been originally intended but never used? Or maybe it's always been wrong.

I should change the define to be TLMI_SMP_PWD instead actually for clarity. I'll fix that.

>
> Also this is not explained in the commit message.
>

Ack - will update the commit message to include this.

Thanks
Mark
  
Hans de Goede May 23, 2023, 1:27 p.m. UTC | #3
Hi,

On 5/23/23 14:43, Mark Pearson wrote:
> Thanks Hans
> 
> On Tue, May 23, 2023, at 6:46 AM, Hans de Goede wrote:
>> Hi Mark,
>>
>> On 5/17/23 20:19, Mark Pearson wrote:
>>> The system password identification was incorrect. This means that if
>>> the password was enabled it wouldn't be detected correctly; and setting
>>> it would not work.
>>>
>>> Correct these mistakes.
>>>
>>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>>> ---
>>>  drivers/platform/x86/think-lmi.c | 4 ++--
>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>>> index d9341305eba9..b8431d3b137f 100644
>>> --- a/drivers/platform/x86/think-lmi.c
>>> +++ b/drivers/platform/x86/think-lmi.c
>>> @@ -171,7 +171,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support");
>>>  #define TLMI_POP_PWD (1 << 0)
>>>  #define TLMI_PAP_PWD (1 << 1)
>>>  #define TLMI_HDD_PWD (1 << 2)
>>> -#define TLMI_SYS_PWD (1 << 3)
>>> +#define TLMI_SYS_PWD (1 << 6)
>>>  #define TLMI_CERT    (1 << 7)
>>>  
>>>  #define to_tlmi_pwd_setting(kobj)  container_of(kobj, struct tlmi_pwd_setting, kobj)
>>> @@ -1504,7 +1504,7 @@ static int tlmi_analyze(void)
>>>  		tlmi_priv.pwd_power->valid = true;
>>>  
>>>  	if (tlmi_priv.opcode_support) {
>>> -		tlmi_priv.pwd_system = tlmi_create_auth("sys", "system");
>>> +		tlmi_priv.pwd_system = tlmi_create_auth("smp", "system");
>>
>> "smp" ?
> 
> Yes - that is what is common across all the platforms.
> https://docs.lenovocdrt.com/#/bios/wmi/wmi_guide?id=change-a-bios-password

Ok, so smp stands for System Management Password I guess ? Might be good to spell
that out somehwere, e.g. in a comment.

Regards,

Hans



> 
> I never quite got a straight answer on the origins of the 'sys' account - I think it may have been originally intended but never used? Or maybe it's always been wrong.
> 
> I should change the define to be TLMI_SMP_PWD instead actually for clarity. I'll fix that.
> 
>>
>> Also this is not explained in the commit message.
>>
> 
> Ack - will update the commit message to include this.
> 
> Thanks
> Mark
>
  
Mark Pearson May 23, 2023, 4:19 p.m. UTC | #4
On Tue, May 23, 2023, at 9:27 AM, Hans de Goede wrote:
> Hi,
>
> On 5/23/23 14:43, Mark Pearson wrote:
>> Thanks Hans
>> 
>> On Tue, May 23, 2023, at 6:46 AM, Hans de Goede wrote:
>>> Hi Mark,
>>>
>>> On 5/17/23 20:19, Mark Pearson wrote:
>>>> The system password identification was incorrect. This means that if
>>>> the password was enabled it wouldn't be detected correctly; and setting
>>>> it would not work.
>>>>
>>>> Correct these mistakes.
>>>>
>>>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>>>> ---
>>>>  drivers/platform/x86/think-lmi.c | 4 ++--
>>>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>>>> index d9341305eba9..b8431d3b137f 100644
>>>> --- a/drivers/platform/x86/think-lmi.c
>>>> +++ b/drivers/platform/x86/think-lmi.c
>>>> @@ -171,7 +171,7 @@ MODULE_PARM_DESC(debug_support, "Enable debug command support");
>>>>  #define TLMI_POP_PWD (1 << 0)
>>>>  #define TLMI_PAP_PWD (1 << 1)
>>>>  #define TLMI_HDD_PWD (1 << 2)
>>>> -#define TLMI_SYS_PWD (1 << 3)
>>>> +#define TLMI_SYS_PWD (1 << 6)
>>>>  #define TLMI_CERT    (1 << 7)
>>>>  
>>>>  #define to_tlmi_pwd_setting(kobj)  container_of(kobj, struct tlmi_pwd_setting, kobj)
>>>> @@ -1504,7 +1504,7 @@ static int tlmi_analyze(void)
>>>>  		tlmi_priv.pwd_power->valid = true;
>>>>  
>>>>  	if (tlmi_priv.opcode_support) {
>>>> -		tlmi_priv.pwd_system = tlmi_create_auth("sys", "system");
>>>> +		tlmi_priv.pwd_system = tlmi_create_auth("smp", "system");
>>>
>>> "smp" ?
>> 
>> Yes - that is what is common across all the platforms.
>> https://docs.lenovocdrt.com/#/bios/wmi/wmi_guide?id=change-a-bios-password
>
> Ok, so smp stands for System Management Password I guess ? Might be 
> good to spell
> that out somehwere, e.g. in a comment.
>

Yes - and will do.

Mark
  

Patch

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index d9341305eba9..b8431d3b137f 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -171,7 +171,7 @@  MODULE_PARM_DESC(debug_support, "Enable debug command support");
 #define TLMI_POP_PWD (1 << 0)
 #define TLMI_PAP_PWD (1 << 1)
 #define TLMI_HDD_PWD (1 << 2)
-#define TLMI_SYS_PWD (1 << 3)
+#define TLMI_SYS_PWD (1 << 6)
 #define TLMI_CERT    (1 << 7)
 
 #define to_tlmi_pwd_setting(kobj)  container_of(kobj, struct tlmi_pwd_setting, kobj)
@@ -1504,7 +1504,7 @@  static int tlmi_analyze(void)
 		tlmi_priv.pwd_power->valid = true;
 
 	if (tlmi_priv.opcode_support) {
-		tlmi_priv.pwd_system = tlmi_create_auth("sys", "system");
+		tlmi_priv.pwd_system = tlmi_create_auth("smp", "system");
 		if (!tlmi_priv.pwd_system)
 			goto fail_clear_attr;