From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Rong Zhang <i@rong.moe>
Cc: "Derek J . Clark" <derekjohn.clark@gmail.com>,
Hans de Goede <hansg@kernel.org>,
Mark Pearson <mpearson-lenovo@squebb.ca>,
Armin Wolf <W_Armin@gmx.de>, Jonathan Corbet <corbet@lwn.net>,
Kurt Borja <kuurtb@gmail.com>,
platform-driver-x86@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH 1/3] platform/x86: lenovo-wmi-helpers: Fix memory leak in lwmi_dev_evaluate_int()
Date: Thu, 2 Apr 2026 13:06:30 +0300 (EEST) [thread overview]
Message-ID: <d1fe81a6-9814-d070-fbdf-66bd5e647a80@linux.intel.com> (raw)
In-Reply-To: <20260401190221.1595264-1-i@rong.moe>
On Thu, 2 Apr 2026, Rong Zhang wrote:
> lwmi_dev_evaluate_int() leaks output.pointer when retval == NULL (found
> by sashiko.dev [1]).
>
> Fix it by moving `ret_obj = output.pointer' outside of the `if (retval)'
> block so that it is always freed by the __free cleanup callback.
>
> No functional change intended.
>
> Fixes: e521d16e76cd ("platform/x86: Add lenovo-wmi-helpers")
> Cc: stable@vger.kernel.org
> Link: https://sashiko.dev/#/patchset/20260331181208.421552-1-derekjohn.clark%40gmail.com [1]
> Signed-off-by: Rong Zhang <i@rong.moe>
> ---
> drivers/platform/x86/lenovo/wmi-helpers.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/lenovo/wmi-helpers.c b/drivers/platform/x86/lenovo/wmi-helpers.c
> index 7379defac500..80021f59d1ef 100644
> --- a/drivers/platform/x86/lenovo/wmi-helpers.c
> +++ b/drivers/platform/x86/lenovo/wmi-helpers.c
> @@ -55,8 +55,9 @@ int lwmi_dev_evaluate_int(struct wmi_device *wdev, u8 instance, u32 method_id,
> if (ACPI_FAILURE(status))
> return -EIO;
>
> + ret_obj = output.pointer;
To follow the best practice, could you please also place the variable
declaration here as well so there's no separate ret_obj = NULL line.
> +
> if (retval) {
> - ret_obj = output.pointer;
> if (!ret_obj)
> return -ENODATA;
--
i.
next prev parent reply other threads:[~2026-04-02 10:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <499fa3efd5be054ffdda77dd00ad4d8d3391e073.camel@rong.moe>
2026-04-01 19:00 ` [PATCH 1/3] platform/x86: lenovo-wmi-helpers: Fix memory leak in lwmi_dev_evaluate_int() Rong Zhang
2026-04-02 10:06 ` Ilpo Järvinen [this message]
2026-04-01 19:00 ` [PATCH 2/3] platform/x86: lenovo-wmi-other: Balance IDA id allocation and free Rong Zhang
2026-04-09 12:29 ` Ilpo Järvinen
2026-04-11 15:54 ` Derek John Clark
2026-04-01 19:00 ` [PATCH 3/3] platform/x86: lenovo-wmi-other: Balance component bind and unbind Rong Zhang
2026-04-09 12:32 ` Ilpo Järvinen
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=d1fe81a6-9814-d070-fbdf-66bd5e647a80@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=W_Armin@gmx.de \
--cc=corbet@lwn.net \
--cc=derekjohn.clark@gmail.com \
--cc=hansg@kernel.org \
--cc=i@rong.moe \
--cc=kuurtb@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@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