From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Miaoqian Lin <linmq006@gmail.com>,
Daniel Golle <daniel@makrotopia.org>,
Andrew Lunn <andrew@lunn.ch>, Paolo Abeni <pabeni@redhat.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.12 07/16] net: phy: mediatek: fix nvmem cell reference leak in mt798x_phy_calibration
Date: Fri, 9 Jan 2026 12:43:48 +0100 [thread overview]
Message-ID: <20260109111951.699301528@linuxfoundation.org> (raw)
In-Reply-To: <20260109111951.415522519@linuxfoundation.org>
6.12-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miaoqian Lin <linmq006@gmail.com>
[ Upstream commit 1e5a541420b8c6d87d88eb50b6b978cdeafee1c9 ]
When nvmem_cell_read() fails in mt798x_phy_calibration(), the function
returns without calling nvmem_cell_put(), leaking the cell reference.
Move nvmem_cell_put() right after nvmem_cell_read() to ensure the cell
reference is always released regardless of the read result.
Found via static analysis and code review.
Fixes: 98c485eaf509 ("net: phy: add driver for MediaTek SoC built-in GE PHYs")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20251211081313.2368460-1-linmq006@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/net/phy/mediatek-ge-soc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/phy/mediatek-ge-soc.c
+++ b/drivers/net/phy/mediatek-ge-soc.c
@@ -1082,9 +1082,9 @@ static int mt798x_phy_calibration(struct
}
buf = (u32 *)nvmem_cell_read(cell, &len);
+ nvmem_cell_put(cell);
if (IS_ERR(buf))
return PTR_ERR(buf);
- nvmem_cell_put(cell);
if (!buf[0] || !buf[1] || !buf[2] || !buf[3] || len < 4 * sizeof(u32)) {
phydev_err(phydev, "invalid efuse data\n");
next prev parent reply other threads:[~2026-01-09 11:44 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-09 11:43 [PATCH 6.12 00/16] 6.12.65-rc1 review Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 01/16] mptcp: fallback earlier on simult connection Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 02/16] mm/page_alloc: change all pageblocks migrate type on coalescing Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 03/16] mm: simplify folio_expected_ref_count() Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 04/16] mm: consider non-anon swap cache folios in folio_expected_ref_count() Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 05/16] mptcp: ensure context reset on disconnect() Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 06/16] wifi: mac80211: Discard Beacon frames to non-broadcast address Greg Kroah-Hartman
2026-01-09 11:43 ` Greg Kroah-Hartman [this message]
2026-01-09 11:43 ` [PATCH 6.12 08/16] drm/amdgpu: Forward VMID reservation errors Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 09/16] cpufreq: intel_pstate: Check IDA only before MSR_IA32_PERF_CTL writes Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 10/16] net: Remove RTNL dance for SIOCBRADDIF and SIOCBRDELIF Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 11/16] sched/fair: Small cleanup to sched_balance_newidle() Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 12/16] sched/fair: Small cleanup to update_newidle_cost() Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 13/16] sched/fair: Proportional newidle balance Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 14/16] virtio_console: fix order of fields cols and rows Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 15/16] pwm: stm32: Always program polarity Greg Kroah-Hartman
2026-01-09 11:43 ` [PATCH 6.12 16/16] Revert "iommu/amd: Skip enabling command/event buffers for kdump" Greg Kroah-Hartman
2026-01-09 14:05 ` [PATCH 6.12 00/16] 6.12.65-rc1 review Slade Watkins
2026-01-09 16:15 ` Jon Hunter
2026-01-09 19:01 ` Brett A C Sheffield
2026-01-09 19:49 ` Florian Fainelli
2026-01-09 23:58 ` Shuah Khan
2026-01-10 1:53 ` Brett Mastbergen
2026-01-10 3:39 ` Peter Schneider
2026-01-10 6:51 ` Ron Economos
2026-01-10 8:30 ` Francesco Dolcini
2026-01-10 10:04 ` Jeffrin Thalakkottoor
2026-01-10 11:27 ` Mark Brown
2026-01-10 21:11 ` Harshit Mogalapalli
2026-01-10 21:19 ` Miguel Ojeda
2026-01-12 10:25 ` Pavel Machek
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=20260109111951.699301528@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=andrew@lunn.ch \
--cc=daniel@makrotopia.org \
--cc=linmq006@gmail.com \
--cc=pabeni@redhat.com \
--cc=patches@lists.linux.dev \
--cc=sashal@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