[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DAXX5FP3VB6T.198C8JS1MVWAL@gmail.com>
Date: Sat, 28 Jun 2025 02:32:15 -0300
From: "Kurt Borja" <kuurtb@...il.com>
To: "Kurt Borja" <kuurtb@...il.com>, "Mark Pearson"
<mpearson-lenovo@...ebb.ca>, "Hans de Goede" <hdegoede@...hat.com>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>
Cc: <platform-driver-x86@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] platform/x86: think-lmi: Fix kobject cleanup
On Sat Jun 28, 2025 at 2:00 AM -03, Kurt Borja wrote:
> Cleanup of allocated kobjects has many flaws.
>
> In tlmi_analyze(), allocated structs with an embedded kobject are freed
> in error paths after the they were already initialized.
>
> In tlmi_release_attr(), which is called in tlmi_sysfs_init() error paths
> and in module exit, kobject_del() is never called. This, between other
> things, leaks the reference of the parent kobject, which is a kset in
> this case.
>
> Fix this flaws simultaneously, 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")
> Signed-off-by: Kurt Borja <kuurtb@...il.com>
I missed some commits:
Fixes: 30e78435d3bf ("platform/x86: think-lmi: Split kobject_init() and kobject_add() calls")
Fixes: f7e506ec4a99 ("platform/x86: think-lmi: Fix possible mem-leaks on tlmi_analyze() error-exit")
--
~Kurt
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists