From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Cc: david.e.box@linux.intel.com, Hans de Goede <hansg@kernel.org>,
platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH] platform/x86/intel/pmt: Fix kobject memory leak on init failure
Date: Tue, 23 Dec 2025 14:00:43 +0200 (EET) [thread overview]
Message-ID: <802187c0-2172-e63e-c855-1d5750b4c2a9@linux.intel.com> (raw)
In-Reply-To: <20251223084041.3832933-1-kaushlendra.kumar@intel.com>
On Tue, 23 Dec 2025, Kaushlendra Kumar wrote:
> When kobject_init_and_add() fails in pmt_features_discovery(), the
> function returns without calling kobject_put(). This violates the
> kobject API contract where kobject_put() must be called even on
> initialization failure to properly release allocated resources.
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
Hi,
Thanks, I've applied this to the review-ilpo-fixes branch but I had to add
Fixes tag myself as your submission did not contain one. In the future,
when fixing an issue, please add a Fixes tag pointing to the commit that
introduced the problem.
> ---
> drivers/platform/x86/intel/pmt/discovery.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/intel/pmt/discovery.c b/drivers/platform/x86/intel/pmt/discovery.c
> index 32713a194a55..9c5b4d0e1fae 100644
> --- a/drivers/platform/x86/intel/pmt/discovery.c
> +++ b/drivers/platform/x86/intel/pmt/discovery.c
> @@ -503,8 +503,10 @@ static int pmt_features_discovery(struct pmt_features_priv *priv,
>
> ret = kobject_init_and_add(&feature->kobj, ktype, &priv->dev->kobj,
> "%s", pmt_feature_names[feature->id]);
> - if (ret)
> + if (ret) {
> + kobject_put(&feature->kobj);
> return ret;
> + }
>
> kobject_uevent(&feature->kobj, KOBJ_ADD);
> pmt_features_add_feat(feature);
--
i.
next prev parent reply other threads:[~2025-12-23 12:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-23 8:40 [PATCH] platform/x86/intel/pmt: Fix kobject memory leak on init failure Kaushlendra Kumar
2025-12-23 12:00 ` Ilpo Järvinen [this message]
2025-12-24 2:56 ` Kumar, Kaushlendra
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=802187c0-2172-e63e-c855-1d5750b4c2a9@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=david.e.box@linux.intel.com \
--cc=hansg@kernel.org \
--cc=kaushlendra.kumar@intel.com \
--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