]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
platform/x86: think-lmi: Fix kobject cleanup
authorKurt Borja <kuurtb@gmail.com>
Mon, 30 Jun 2025 17:31:20 +0000 (14:31 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 14:03:20 +0000 (16:03 +0200)
commit98002f1ac947f63f8eda0f3d1f576a50a4daa91f
tree77589d8d609b3bfd02f156c12d2ec5e0136df983
parentcb3e3244d88da68864f1699f61b357e611319c8f
platform/x86: think-lmi: Fix kobject cleanup

commit 9110056fe10b0519529bdbbac37311a5037ea0c2 upstream.

In tlmi_analyze(), allocated structs with an embedded kobject are freed
in error paths after the they were already initialized.

Fix this by first by avoiding the initialization of kobjects in
tlmi_analyze() and then by correctly cleaning them up in
tlmi_release_attr() using their kset's kobject list.

Fixes: a40cd7ef22fb ("platform/x86: think-lmi: Add WMI interface support on Lenovo platforms")
Fixes: 30e78435d3bf ("platform/x86: think-lmi: Split kobject_init() and kobject_add() calls")
Cc: stable@vger.kernel.org
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Kurt Borja <kuurtb@gmail.com>
Link: https://lore.kernel.org/r/20250630-lmi-fix-v3-2-ce4f81c9c481@gmail.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/platform/x86/think-lmi.c