]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
platform/x86: thinklmi: improved DMI handling
authorMark Pearson <mpearson-lenovo@squebb.ca>
Tue, 10 Jun 2025 19:28:24 +0000 (15:28 -0400)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Wed, 11 Jun 2025 08:00:16 +0000 (11:00 +0300)
Fix issues reported by kernel test robot.
 - Require DMI for think-lmi.
 - Check return from getting serial string

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202506062319.F0IpDxF6-lkp@intel.com/
Signed-off-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250610192830.1731454-1-mpearson-lenovo@squebb.ca
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/Kconfig
drivers/platform/x86/think-lmi.c

index e5cbd58a99f3fa4b5851c6aca1d8ef1baff0dd7d..9f39547d98f63576e2618b1c1c364b0dea0784cb 100644 (file)
@@ -659,6 +659,7 @@ config THINKPAD_ACPI_HOTKEY_POLL
 config THINKPAD_LMI
        tristate "Lenovo WMI-based systems management driver"
        depends on ACPI_WMI
+       depends on DMI
        select FW_ATTR_CLASS
        help
          This driver allows changing BIOS settings on Lenovo machines whose
index 00b1e7c79a3d1e95621701530ea5e11015414498..02ede1ec99e976afb280a0c4fdb319c60b3faea9 100644 (file)
@@ -772,6 +772,7 @@ static ssize_t certificate_store(struct kobject *kobj,
        struct tlmi_pwd_setting *setting = to_tlmi_pwd_setting(kobj);
        enum cert_install_mode install_mode = TLMI_CERT_INSTALL;
        char *auth_str, *new_cert;
+       const char *serial;
        char *signature;
        char *guid;
        int ret;
@@ -789,9 +790,10 @@ static ssize_t certificate_store(struct kobject *kobj,
                        return -EACCES;
 
                /* Format: 'serial#, signature' */
-               auth_str = cert_command(setting,
-                                       dmi_get_system_info(DMI_PRODUCT_SERIAL),
-                                       setting->signature);
+               serial = dmi_get_system_info(DMI_PRODUCT_SERIAL);
+               if (!serial)
+                       return -ENODEV;
+               auth_str = cert_command(setting, serial, setting->signature);
                if (!auth_str)
                        return -ENOMEM;