The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] platform/x86: think-lmi: Keep pending save state on failure
@ 2026-08-10 12:08 Thorsten Blum
  2026-08-11 19:29 ` Mark Pearson
  0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2026-08-10 12:08 UTC (permalink / raw)
  To: Mark Pearson, Derek J. Clark, Hans de Goede, Ilpo Järvinen
  Cc: Thorsten Blum, stable, platform-driver-x86, linux-kernel

In save_settings_store(), the opcode and legacy password paths do not
check if saving BIOS settings failed, but instead unconditionally clear
save_required and set reboot_required, losing the pending save state.

Check the save result in those paths too.

Fixes: 318d97849fc2 ("platform/x86: think-lmi: Add bulk save feature")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/platform/x86/lenovo/think-lmi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/platform/x86/lenovo/think-lmi.c b/drivers/platform/x86/lenovo/think-lmi.c
index e215e86e3db7..cc0a85d1b832 100644
--- a/drivers/platform/x86/lenovo/think-lmi.c
+++ b/drivers/platform/x86/lenovo/think-lmi.c
@@ -1347,6 +1347,8 @@ static ssize_t save_settings_store(struct kobject *kobj, struct kobj_attribute *
 					goto out;
 			}
 			ret = tlmi_save_bios_settings("");
+			if (ret)
+				goto out;
 		} else { /* old non-opcode based authentication method (deprecated) */
 			if (tlmi_priv.pwd_admin->pwd_enabled && tlmi_priv.pwd_admin->password[0]) {
 				auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
@@ -1363,6 +1365,8 @@ static ssize_t save_settings_store(struct kobject *kobj, struct kobj_attribute *
 				ret = tlmi_save_bios_settings(auth_str);
 			else
 				ret = tlmi_save_bios_settings("");
+			if (ret)
+				goto out;
 		}
 		tlmi_priv.save_required = false;
 		tlmi_priv.reboot_required = true;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: think-lmi: Keep pending save state on failure
  2026-08-10 12:08 [PATCH] platform/x86: think-lmi: Keep pending save state on failure Thorsten Blum
@ 2026-08-11 19:29 ` Mark Pearson
  2026-08-11 20:39   ` Thorsten Blum
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Pearson @ 2026-08-11 19:29 UTC (permalink / raw)
  To: Thorsten Blum, Derek J . Clark, Hans de Goede, Ilpo Järvinen
  Cc: stable, platform-driver-x86@vger.kernel.org, linux-kernel

Hi Thorsten,

On Mon, Aug 10, 2026, at 8:08 AM, Thorsten Blum wrote:
> In save_settings_store(), the opcode and legacy password paths do not
> check if saving BIOS settings failed, but instead unconditionally clear
> save_required and set reboot_required, losing the pending save state.
>
> Check the save result in those paths too.
>
> Fixes: 318d97849fc2 ("platform/x86: think-lmi: Add bulk save feature")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/platform/x86/lenovo/think-lmi.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/platform/x86/lenovo/think-lmi.c 
> b/drivers/platform/x86/lenovo/think-lmi.c
> index e215e86e3db7..cc0a85d1b832 100644
> --- a/drivers/platform/x86/lenovo/think-lmi.c
> +++ b/drivers/platform/x86/lenovo/think-lmi.c
> @@ -1347,6 +1347,8 @@ static ssize_t save_settings_store(struct kobject 
> *kobj, struct kobj_attribute *
>  					goto out;
>  			}
>  			ret = tlmi_save_bios_settings("");
> +			if (ret)
> +				goto out;
>  		} else { /* old non-opcode based authentication method (deprecated) 
> */
>  			if (tlmi_priv.pwd_admin->pwd_enabled && 
> tlmi_priv.pwd_admin->password[0]) {
>  				auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
> @@ -1363,6 +1365,8 @@ static ssize_t save_settings_store(struct kobject 
> *kobj, struct kobj_attribute *
>  				ret = tlmi_save_bios_settings(auth_str);
>  			else
>  				ret = tlmi_save_bios_settings("");
> +			if (ret)
> +				goto out;
>  		}
>  		tlmi_priv.save_required = false;
>  		tlmi_priv.reboot_required = true;

Curious - have you actually hit this condition?

My main thought is that if the save fails - chances are that something is pretty messed up and doing another save isn't going to fix it. Most likely you're going to have to reboot.

I'll see if I can get an answer from the FW team on expectations - but getting straight answers for error paths without a repro mechanism can be tricky.

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] platform/x86: think-lmi: Keep pending save state on failure
  2026-08-11 19:29 ` Mark Pearson
@ 2026-08-11 20:39   ` Thorsten Blum
  0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-08-11 20:39 UTC (permalink / raw)
  To: Mark Pearson
  Cc: Derek J . Clark, Hans de Goede, Ilpo Järvinen, stable,
	platform-driver-x86@vger.kernel.org, linux-kernel

On Tue, Aug 11, 2026 at 03:29:16PM -0400, Mark Pearson wrote:
> Hi Thorsten,
> 
> On Mon, Aug 10, 2026, at 8:08 AM, Thorsten Blum wrote:
> > In save_settings_store(), the opcode and legacy password paths do not
> > check if saving BIOS settings failed, but instead unconditionally clear
> > save_required and set reboot_required, losing the pending save state.
> >
> > Check the save result in those paths too.
> >
> > Fixes: 318d97849fc2 ("platform/x86: think-lmi: Add bulk save feature")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> >  drivers/platform/x86/lenovo/think-lmi.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/platform/x86/lenovo/think-lmi.c 
> > b/drivers/platform/x86/lenovo/think-lmi.c
> > index e215e86e3db7..cc0a85d1b832 100644
> > --- a/drivers/platform/x86/lenovo/think-lmi.c
> > +++ b/drivers/platform/x86/lenovo/think-lmi.c
> > @@ -1347,6 +1347,8 @@ static ssize_t save_settings_store(struct kobject 
> > *kobj, struct kobj_attribute *
> >  					goto out;
> >  			}
> >  			ret = tlmi_save_bios_settings("");
> > +			if (ret)
> > +				goto out;
> >  		} else { /* old non-opcode based authentication method (deprecated) 
> > */
> >  			if (tlmi_priv.pwd_admin->pwd_enabled && 
> > tlmi_priv.pwd_admin->password[0]) {
> >  				auth_str = kasprintf(GFP_KERNEL, "%s,%s,%s;",
> > @@ -1363,6 +1365,8 @@ static ssize_t save_settings_store(struct kobject 
> > *kobj, struct kobj_attribute *
> >  				ret = tlmi_save_bios_settings(auth_str);
> >  			else
> >  				ret = tlmi_save_bios_settings("");
> > +			if (ret)
> > +				goto out;
> >  		}
> >  		tlmi_priv.save_required = false;
> >  		tlmi_priv.reboot_required = true;
> 
> Curious - have you actually hit this condition?

No, I was just reading the code and wondered why those return values
aren't checked for errors.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-11 20:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-10 12:08 [PATCH] platform/x86: think-lmi: Keep pending save state on failure Thorsten Blum
2026-08-11 19:29 ` Mark Pearson
2026-08-11 20:39   ` Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox