diff mbox series

[3/4] platform/x86: think-lmi: Allow empty admin password

Message ID 20241021193837.7641-3-mpearson-lenovo@squebb.ca (mailing list archive)
State Changes Requested, archived
Headers show
Series [1/4] platform/x86: think-lmi: improve check if BIOS account security enabled | expand

Commit Message

Mark Pearson Oct. 21, 2024, 7:38 p.m. UTC
SVP = BIOS Supervisor/Admin password
SMP = BIOS System password

If SMP ACL is enabled in the BIOS then the system allows you to set the
SMP without a SVP password configured. Change code to allow this.
BIOS will return permissions error if SVP is required.

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

Comments

Ilpo Järvinen Oct. 22, 2024, 7:59 a.m. UTC | #1
On Mon, 21 Oct 2024, Mark Pearson wrote:

> SVP = BIOS Supervisor/Admin password
> SMP = BIOS System password
> 
> If SMP ACL is enabled in the BIOS then the system allows you to set the
> SMP without a SVP password configured. Change code to allow this.
> BIOS will return permissions error if SVP is required.
> 
> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
> ---
>  drivers/platform/x86/think-lmi.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
> index 46ab82fb2898..751e351dfc42 100644
> --- a/drivers/platform/x86/think-lmi.c
> +++ b/drivers/platform/x86/think-lmi.c
> @@ -469,7 +469,12 @@ static ssize_t new_password_store(struct kobject *kobj,
>  		if (ret)
>  			goto out;
>  
> -		if (tlmi_priv.pwd_admin->pwd_enabled) {
> +		/*
> +		 * Note admin password not always required if SMPControl enabled in BIOS,

is not always required

> +		 * So only set if it's configured.
> +		 * Let BIOS figure it out - we'll get an error if operation not permitted

operation is not permitted.

Please reflow the comment to fit into 80 chars (this only relates to 
comments to keep their line lengths readable without large eye movement).

> +		 */
> +		if (tlmi_priv.pwd_admin->pwd_enabled && strlen(tlmi_priv.pwd_admin->password)) {
>  			ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
>  					tlmi_priv.pwd_admin->password);
>  			if (ret)
>
Mark Pearson Oct. 22, 2024, 7:19 p.m. UTC | #2
Hi Ilpo

On Tue, Oct 22, 2024, at 3:59 AM, Ilpo Järvinen wrote:
> On Mon, 21 Oct 2024, Mark Pearson wrote:
>
>> SVP = BIOS Supervisor/Admin password
>> SMP = BIOS System password
>> 
>> If SMP ACL is enabled in the BIOS then the system allows you to set the
>> SMP without a SVP password configured. Change code to allow this.
>> BIOS will return permissions error if SVP is required.
>> 
>> Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
>> ---
>>  drivers/platform/x86/think-lmi.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
>> index 46ab82fb2898..751e351dfc42 100644
>> --- a/drivers/platform/x86/think-lmi.c
>> +++ b/drivers/platform/x86/think-lmi.c
>> @@ -469,7 +469,12 @@ static ssize_t new_password_store(struct kobject *kobj,
>>  		if (ret)
>>  			goto out;
>>  
>> -		if (tlmi_priv.pwd_admin->pwd_enabled) {
>> +		/*
>> +		 * Note admin password not always required if SMPControl enabled in BIOS,
>
> is not always required
>
>> +		 * So only set if it's configured.
>> +		 * Let BIOS figure it out - we'll get an error if operation not permitted
>
> operation is not permitted.
>
> Please reflow the comment to fit into 80 chars (this only relates to 
> comments to keep their line lengths readable without large eye movement).
>
>> +		 */
>> +		if (tlmi_priv.pwd_admin->pwd_enabled && strlen(tlmi_priv.pwd_admin->password)) {
>>  			ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
>>  					tlmi_priv.pwd_admin->password);
>>  			if (ret)
>> 
>
> -- 
>  i.

Thanks for the review.
I'll update those. I'll give it a couple of days in case there is any other feedback
Mark
diff mbox series

Patch

diff --git a/drivers/platform/x86/think-lmi.c b/drivers/platform/x86/think-lmi.c
index 46ab82fb2898..751e351dfc42 100644
--- a/drivers/platform/x86/think-lmi.c
+++ b/drivers/platform/x86/think-lmi.c
@@ -469,7 +469,12 @@  static ssize_t new_password_store(struct kobject *kobj,
 		if (ret)
 			goto out;
 
-		if (tlmi_priv.pwd_admin->pwd_enabled) {
+		/*
+		 * Note admin password not always required if SMPControl enabled in BIOS,
+		 * So only set if it's configured.
+		 * Let BIOS figure it out - we'll get an error if operation not permitted
+		 */
+		if (tlmi_priv.pwd_admin->pwd_enabled && strlen(tlmi_priv.pwd_admin->password)) {
 			ret = tlmi_opcode_setting("WmiOpcodePasswordAdmin",
 					tlmi_priv.pwd_admin->password);
 			if (ret)