From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Johan Hovold <johan+linaro@kernel.org>,
Zijun Hu <quic_zijuhu@quicinc.com>, Vinod Koul <vkoul@kernel.org>
Subject: [PATCH 6.1 12/60] phy: core: Fix an OF node refcount leakage in of_phy_provider_lookup()
Date: Mon, 30 Dec 2024 16:42:22 +0100 [thread overview]
Message-ID: <20241230154207.754244527@linuxfoundation.org> (raw)
In-Reply-To: <20241230154207.276570972@linuxfoundation.org>
6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <quic_zijuhu@quicinc.com>
commit a2d633cb1421e679b56f1a9fe1f42f089706f1ed upstream.
For macro for_each_child_of_node(parent, child), refcount of @child has
been increased before entering its loop body, so normally needs to call
of_node_put(@child) before returning from the loop body to avoid refcount
leakage.
of_phy_provider_lookup() has such usage but does not call of_node_put()
before returning, so cause leakage of the OF node refcount.
Fix by simply calling of_node_put() before returning from the loop body.
The APIs affected by this issue are shown below since they indirectly
invoke problematic of_phy_provider_lookup().
phy_get()
of_phy_get()
devm_phy_get()
devm_of_phy_get()
devm_of_phy_get_by_index()
Fixes: 2a4c37016ca9 ("phy: core: Fix of_phy_provider_lookup to return PHY provider for sub node")
Cc: stable@vger.kernel.org
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241213-phy_core_fix-v6-5-40ae28f5015a@quicinc.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/phy/phy-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -138,8 +138,10 @@ static struct phy_provider *of_phy_provi
return phy_provider;
for_each_child_of_node(phy_provider->children, child)
- if (child == node)
+ if (child == node) {
+ of_node_put(child);
return phy_provider;
+ }
}
return ERR_PTR(-EPROBE_DEFER);
next prev parent reply other threads:[~2024-12-30 15:44 UTC|newest]
Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 15:42 [PATCH 6.1 00/60] 6.1.123-rc1 review Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 01/60] media: dvb-frontends: dib3000mb: fix uninit-value in dib3000_write_reg Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 02/60] mm/vmstat: fix a W=1 clang compiler warning Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 03/60] tcp_bpf: Charge receive socket buffer in bpf_tcp_ingress() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 04/60] tcp_bpf: Add sk_rmem_alloc related logic for tcp_bpf ingress redirection Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 05/60] bpf: Check negative offsets in __bpf_skb_min_len() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 06/60] nfsd: restore callback functionality for NFSv4.0 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 07/60] mtd: diskonchip: Cast an operand to prevent potential overflow Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 08/60] mtd: rawnand: arasan: Fix double assertion of chip-select Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 09/60] mtd: rawnand: arasan: Fix missing de-registration of NAND Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 10/60] phy: qcom-qmp: Fix register name in RX Lane config of SC8280XP Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 11/60] phy: core: Fix an OF node refcount leakage in _of_phy_get() Greg Kroah-Hartman
2024-12-30 15:42 ` Greg Kroah-Hartman [this message]
2024-12-30 15:42 ` [PATCH 6.1 13/60] phy: core: Fix that API devm_phy_put() fails to release the phy Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 14/60] phy: core: Fix that API devm_of_phy_provider_unregister() fails to unregister the phy provider Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 15/60] phy: core: Fix that API devm_phy_destroy() fails to destroy the phy Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 16/60] phy: usb: Toggle the PHY power during init Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 17/60] phy: rockchip: naneng-combphy: fix phy reset Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 18/60] dmaengine: mv_xor: fix child node refcount handling in early exit Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 19/60] dmaengine: dw: Select only supported masters for ACPI devices Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 20/60] dmaengine: tegra: Return correct DMA status when paused Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 21/60] dmaengine: apple-admac: Avoid accessing registers in probe Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 22/60] dmaengine: at_xdmac: avoid null_prt_deref in at_xdmac_prep_dma_memset Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 23/60] mtd: rawnand: fix double free in atmel_pmecc_create_user() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 24/60] powerpc/pseries/vas: Add close() callback in vas_vm_ops struct Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 25/60] stddef: make __struct_group() UAPI C++-friendly Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 26/60] tracing/kprobe: Make trace_kprobes module callback called after jump_label update Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 27/60] watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 28/60] scsi: qla1280: Fix hw revision numbering for ISP1020/1040 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 29/60] scsi: megaraid_sas: Fix for a potential deadlock Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 30/60] ALSA: hda/conexant: fix Z60MR100 startup pop issue Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 31/60] smb: server: Fix building with GCC 15 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 32/60] regmap: Use correct format specifier for logging range errors Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 33/60] platform/x86: asus-nb-wmi: Ignore unknown event 0xCF Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 34/60] scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 35/60] scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 36/60] drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 37/60] virtio-blk: dont keep queue frozen during system suspend Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 38/60] blk-mq: register cpuhp callback after hctx is added to xarray table Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 39/60] vmalloc: fix accounting with i915 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 40/60] MIPS: Probe toolchain support of -msym32 Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 41/60] MIPS: mipsregs: Set proper ISA level for virt extensions Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 42/60] net/mlx5e: Dont call cleanup on profile rollback failure Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 43/60] bpf: Check validity of link->type in bpf_link_show_fdinfo() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 44/60] ALSA: hda/realtek: fix mute/micmute LEDs dont work for EliteBook X G1i Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 45/60] ALSA: hda/realtek: fix micmute LEDs dont work on HP Laptops Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 46/60] pmdomain: core: Add missing put_device() Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 47/60] sched/core: Report correct state for TASK_IDLE | TASK_FREEZABLE Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 48/60] freezer, sched: Report frozen tasks as D instead of R Greg Kroah-Hartman
2024-12-30 15:42 ` [PATCH 6.1 49/60] tracing: Constify string literal data member in struct trace_event_call Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 50/60] tracing: Prevent bad count for tracing_cpumask_write Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 51/60] io_uring/sqpoll: fix sqpoll error handling races Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 52/60] i2c: microchip-core: actually use repeated sends Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 53/60] i2c: imx: add imx7d compatible string for applying erratum ERR007805 Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 54/60] i2c: microchip-core: fix "ghost" detections Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 55/60] power: supply: gpio-charger: Fix set charge current limits Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 56/60] btrfs: avoid monopolizing a core when activating a swap file Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 57/60] btrfs: sysfs: fix direct super block member reads Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 58/60] nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 59/60] Revert "rcu-tasks: Fix access non-existent percpu rtpcp variable in rcu_tasks_need_gpcb()" Greg Kroah-Hartman
2024-12-30 15:43 ` [PATCH 6.1 60/60] ALSA: hda/realtek: Fix spelling mistake "Firelfy" -> "Firefly" Greg Kroah-Hartman
2024-12-30 17:39 ` [PATCH 6.1 00/60] 6.1.123-rc1 review Florian Fainelli
2024-12-30 19:28 ` Pavel Machek
2024-12-30 20:59 ` Shuah Khan
2024-12-31 8:23 ` Muhammad Usama Anjum
2024-12-31 9:44 ` Naresh Kamboju
2024-12-31 22:38 ` [PATCH 6.1] " Hardik Garg
2024-12-31 23:00 ` [PATCH 6.1 00/60] " Ron Economos
2025-01-02 10:42 ` Pavel Machek
[not found] ` <2025010357-laziness-shield-0ad0@gregkh>
2025-01-04 17:54 ` Buggy patch -- " Pavel Machek
2025-01-06 10:04 ` Greg Kroah-Hartman
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=20241230154207.754244527@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=johan+linaro@kernel.org \
--cc=patches@lists.linux.dev \
--cc=quic_zijuhu@quicinc.com \
--cc=stable@vger.kernel.org \
--cc=vkoul@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