mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Kurt Borja" <kuurtb@gmail.com>
To: "Kurt Borja" <kuurtb@gmail.com>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: <platform-driver-x86@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] platform/x86: think-lmi: Fix kobject cleanup
Date: Sat, 28 Jun 2025 02:32:15 -0300	[thread overview]
Message-ID: <DAXX5FP3VB6T.198C8JS1MVWAL@gmail.com> (raw)
In-Reply-To: <20250628-lmi-fix-v1-2-c6eec9aa3ca7@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]

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@gmail.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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2025-06-28  5:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-28  5:00 [PATCH 0/3] platform/x86: think-lmi: Fix resource cleanup flaws Kurt Borja
2025-06-28  5:00 ` [PATCH 1/3] platform/x86: think-lmi: Create ksets consecutively Kurt Borja
2025-06-28  5:00 ` [PATCH 2/3] platform/x86: think-lmi: Fix kobject cleanup Kurt Borja
2025-06-28  5:32   ` Kurt Borja [this message]
2025-06-28  5:00 ` [PATCH 3/3] platform/x86: think-lmi: Fix sysfs group cleanup Kurt Borja
2025-06-28 19:30 ` [PATCH 0/3] platform/x86: think-lmi: Fix resource cleanup flaws Mark Pearson
2025-06-28 20:26   ` Kurt Borja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DAXX5FP3VB6T.198C8JS1MVWAL@gmail.com \
    --to=kuurtb@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®