All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kurt Borja" <kuurtb@gmail.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	"Mark Pearson" <mpearson-lenovo@squebb.ca>
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: Tue, 18 Feb 2025 13:18:25 -0500	[thread overview]
Message-ID: <D7VS189559P4.BKIIWBE7VCPE@gmail.com> (raw)
In-Reply-To: <CAJZ5v0hv3frfZCLgANBi-Kn8LCiuoWFSMcjDSipXQyycS5i1rw@mail.gmail.com>

On Tue Feb 18, 2025 at 1:07 PM -05, Rafael J. Wysocki wrote:
> On Sat, Feb 15, 2025 at 3:18 AM Mark Pearson <mpearson-lenovo@squebb.ca> wrote:
>>
>>
>> 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>
>
> Applied as 6.15 material, thanks!

Hi Rafael,

Thank you!

I believe this should be merged as a fix for v6.14-rc4 before
commit 77be5cacb2c2 hits stable.

-- 
 ~ Kurt


  reply	other threads:[~2025-02-18 18: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
2025-02-18 18:07   ` Rafael J. Wysocki
2025-02-18 18:18     ` Kurt Borja [this message]
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=D7VS189559P4.BKIIWBE7VCPE@gmail.com \
    --to=kuurtb@gmail.com \
    --cc=W_Armin@gmx.de \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=mpearson-lenovo@squebb.ca \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.