From: "Mark Pearson" <mpearson-lenovo@squebb.ca>
To: "Kurt Borja" <kuurtb@gmail.com>, "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Len Brown" <lenb@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Limonciello, Mario" <mario.limonciello@amd.com>,
"Armin Wolf" <W_Armin@gmx.de>, "Gergo Koteles" <soyer@irl.hu>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ACPI: platform_profile: Fix memory leak in profile_class_is_visible()
Date: Fri, 14 Feb 2025 21:18:10 -0500 [thread overview]
Message-ID: <9a8a5084-589d-4c45-a011-5bf4d0dfc8ba@app.fastmail.com> (raw)
In-Reply-To: <20250212193058.32110-1-kuurtb@gmail.com>
On Wed, Feb 12, 2025, at 2:30 PM, Kurt Borja wrote:
> If class_find_device() finds a device it's reference count is
> incremented. Call put_device() to drop this reference before returning.
>
> Fixes: 77be5cacb2c2 ("ACPI: platform_profile: Create class for ACPI
> platform profile")
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
> drivers/acpi/platform_profile.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/platform_profile.c
> b/drivers/acpi/platform_profile.c
> index fc92e43d0fe9..2ad53cc6aae5 100644
> --- a/drivers/acpi/platform_profile.c
> +++ b/drivers/acpi/platform_profile.c
> @@ -417,8 +417,14 @@ static int profile_class_registered(struct device
> *dev, const void *data)
>
> static umode_t profile_class_is_visible(struct kobject *kobj, struct
> attribute *attr, int idx)
> {
> - if (!class_find_device(&platform_profile_class, NULL, NULL,
> profile_class_registered))
> + struct device *dev;
> +
> + dev = class_find_device(&platform_profile_class, NULL, NULL,
> profile_class_registered);
> + if (!dev)
> return 0;
> +
> + put_device(dev);
> +
> return attr->mode;
> }
>
>
> base-commit: 3e3e377dd1f300bbdd230533686ce9c9f4f8a90d
> --
> 2.48.1
Good find. Looks good to me.
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Mark
next prev parent reply other threads:[~2025-02-15 2:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 19:30 [PATCH] ACPI: platform_profile: Fix memory leak in profile_class_is_visible() Kurt Borja
2025-02-15 2:18 ` Mark Pearson [this message]
2025-02-18 18:07 ` Rafael J. Wysocki
2025-02-18 18:18 ` Kurt Borja
2025-02-18 18:27 ` Rafael J. Wysocki
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=9a8a5084-589d-4c45-a011-5bf4d0dfc8ba@app.fastmail.com \
--to=mpearson-lenovo@squebb.ca \
--cc=W_Armin@gmx.de \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kuurtb@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=rafael@kernel.org \
--cc=soyer@irl.hu \
/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