From: Hans de Goede <hdegoede@redhat.com>
To: Armin Wolf <W_Armin@gmx.de>, prasanth.ksr@dell.com, markgross@kernel.org
Cc: Dell.Client.Kernel@dell.com, platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] platform/x86: dell-sysman: Fix reference leak
Date: Wed, 9 Aug 2023 21:56:58 +0200 [thread overview]
Message-ID: <d10e5e17-920d-de61-b6a5-bfd8acb6fa04@redhat.com> (raw)
In-Reply-To: <20230805053610.7106-1-W_Armin@gmx.de>
Hi,
On 8/5/23 07:36, Armin Wolf wrote:
> If a duplicate attribute is found using kset_find_obj(),
> a reference to that attribute is returned. This means
> that we need to dispose it accordingly. Use kobject_put()
> to dispose the duplicate attribute in such a case.
>
> Compile-tested only.
>
> Fixes: e8a60aa7404b ("platform/x86: Introduce support for Systems Management Driver over WMI for Dell Systems")
> Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/dell/dell-wmi-sysman/sysman.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> index b68dd11cb892..b929b4f82420 100644
> --- a/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> +++ b/drivers/platform/x86/dell/dell-wmi-sysman/sysman.c
> @@ -393,6 +393,7 @@ static int init_bios_attributes(int attr_type, const char *guid)
> struct kobject *attr_name_kobj; //individual attribute names
> union acpi_object *obj = NULL;
> union acpi_object *elements;
> + struct kobject *duplicate;
> struct kset *tmp_set;
> int min_elements;
>
> @@ -451,9 +452,11 @@ static int init_bios_attributes(int attr_type, const char *guid)
> else
> tmp_set = wmi_priv.main_dir_kset;
>
> - if (kset_find_obj(tmp_set, elements[ATTR_NAME].string.pointer)) {
> - pr_debug("duplicate attribute name found - %s\n",
> - elements[ATTR_NAME].string.pointer);
> + duplicate = kset_find_obj(tmp_set, elements[ATTR_NAME].string.pointer);
> + if (duplicate) {
> + pr_debug("Duplicate attribute name found - %s\n",
> + elements[ATTR_NAME].string.pointer);
> + kobject_put(duplicate);
> goto nextobj;
> }
>
> --
> 2.39.2
>
prev parent reply other threads:[~2023-08-09 19:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-05 5:36 Armin Wolf
2023-08-09 19:56 ` Hans de Goede [this message]
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=d10e5e17-920d-de61-b6a5-bfd8acb6fa04@redhat.com \
--to=hdegoede@redhat.com \
--cc=Dell.Client.Kernel@dell.com \
--cc=W_Armin@gmx.de \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=prasanth.ksr@dell.com \
/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®