From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: yongxin.liu@windriver.com
Cc: LKML <linux-kernel@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>,
david.e.box@linux.intel.com, chao.qin@intel.com,
yong.liang.choong@linux.intel.com, kuba@kernel.org,
platform-driver-x86@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net] platform/x86: intel_pmc_ipc: fix ACPI buffer memory leak
Date: Mon, 24 Nov 2025 15:39:28 +0200 (EET) [thread overview]
Message-ID: <f1124090-a8e4-6220-093a-47c449c98436@linux.intel.com> (raw)
In-Reply-To: <20251124075748.3028295-1-yongxin.liu@windriver.com>
On Mon, 24 Nov 2025, yongxin.liu@windriver.com wrote:
> From: Yongxin Liu <yongxin.liu@windriver.com>
>
> The intel_pmc_ipc() function uses ACPI_ALLOCATE_BUFFER to allocate memory
> for the ACPI evaluation result but never frees it, causing a 192-byte
> memory leak on each call.
>
> This leak is triggered during network interface initialization when the
> stmmac driver calls intel_mac_finish() -> intel_pmc_ipc().
>
> unreferenced object 0xffff96a848d6ea80 (size 192):
> comm "dhcpcd", pid 541, jiffies 4294684345
> hex dump (first 32 bytes):
> 04 00 00 00 05 00 00 00 98 ea d6 48 a8 96 ff ff ...........H....
> 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 ................
> backtrace (crc b1564374):
> kmemleak_alloc+0x2d/0x40
> __kmalloc_noprof+0x2fa/0x730
> acpi_ut_initialize_buffer+0x83/0xc0
> acpi_evaluate_object+0x29a/0x2f0
> intel_pmc_ipc+0xfd/0x170
> intel_mac_finish+0x168/0x230
> stmmac_mac_finish+0x3d/0x50
> phylink_major_config+0x22b/0x5b0
> phylink_mac_initial_config.constprop.0+0xf1/0x1b0
> phylink_start+0x8e/0x210
> __stmmac_open+0x12c/0x2b0
> stmmac_open+0x23c/0x380
> __dev_open+0x11d/0x2c0
> __dev_change_flags+0x1d2/0x250
> netif_change_flags+0x2b/0x70
> dev_change_flags+0x40/0xb0
>
> Add kfree() to properly release the allocated buffer.
>
> Cc: stable@vger.kernel.org
> Fixes: 7e2f7e25f6ff ("arch: x86: add IPC mailbox accessor function and add SoC register access")
> Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
> ---
> include/linux/platform_data/x86/intel_pmc_ipc.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/linux/platform_data/x86/intel_pmc_ipc.h b/include/linux/platform_data/x86/intel_pmc_ipc.h
> index 1d34435b7001..2fd5e684ce26 100644
> --- a/include/linux/platform_data/x86/intel_pmc_ipc.h
> +++ b/include/linux/platform_data/x86/intel_pmc_ipc.h
> @@ -89,6 +89,7 @@ static inline int intel_pmc_ipc(struct pmc_ipc_cmd *ipc_cmd, struct pmc_ipc_rbuf
> return -EINVAL;
> }
>
> + kfree (obj);
Good catch but this fix doesn't address all possible paths. So please use
cleanup.h instead:
union acpi_object *obj __free(kfree) = buffer.pointer;
And don't forget to add the #include.
> return 0;
> #else
> return -ENODEV;
>
--
i.
next prev parent reply other threads:[~2025-11-24 13:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 7:57 yongxin.liu
2025-11-24 13:39 ` Ilpo Järvinen [this message]
2025-11-25 0:29 ` Andrew Lunn
2025-11-25 1:25 ` Liu, Yongxin
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=f1124090-a8e4-6220-093a-47c449c98436@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=chao.qin@intel.com \
--cc=david.e.box@linux.intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=yong.liang.choong@linux.intel.com \
--cc=yongxin.liu@windriver.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®