public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>,
	Andrew Lunn <andrew@lunn.ch>, Paolo Abeni <pabeni@redhat.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.1 31/83] net: mdiobus: fix an OF node reference leak
Date: Mon, 23 Dec 2024 16:59:10 +0100	[thread overview]
Message-ID: <20241223155354.855533926@linuxfoundation.org> (raw)
In-Reply-To: <20241223155353.641267612@linuxfoundation.org>

6.1-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>

[ Upstream commit 572af9f284669d31d9175122bbef9bc62cea8ded ]

fwnode_find_mii_timestamper() calls of_parse_phandle_with_fixed_args()
but does not decrement the refcount of the obtained OF node. Add an
of_node_put() call before returning from the function.

This bug was detected by an experimental static analysis tool that I am
developing.

Fixes: bc1bee3b87ee ("net: mdiobus: Introduce fwnode_mdiobus_register_phy()")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20241218035106.1436405-1-joe@pf.is.s.u-tokyo.ac.jp
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/mdio/fwnode_mdio.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mdio/fwnode_mdio.c b/drivers/net/mdio/fwnode_mdio.c
index b782c35c4ac1..8ada397bc357 100644
--- a/drivers/net/mdio/fwnode_mdio.c
+++ b/drivers/net/mdio/fwnode_mdio.c
@@ -38,6 +38,7 @@ fwnode_find_pse_control(struct fwnode_handle *fwnode)
 static struct mii_timestamper *
 fwnode_find_mii_timestamper(struct fwnode_handle *fwnode)
 {
+	struct mii_timestamper *mii_ts;
 	struct of_phandle_args arg;
 	int err;
 
@@ -51,10 +52,16 @@ fwnode_find_mii_timestamper(struct fwnode_handle *fwnode)
 	else if (err)
 		return ERR_PTR(err);
 
-	if (arg.args_count != 1)
-		return ERR_PTR(-EINVAL);
+	if (arg.args_count != 1) {
+		mii_ts = ERR_PTR(-EINVAL);
+		goto put_node;
+	}
+
+	mii_ts = register_mii_timestamper(arg.np, arg.args[0]);
 
-	return register_mii_timestamper(arg.np, arg.args[0]);
+put_node:
+	of_node_put(arg.np);
+	return mii_ts;
 }
 
 int fwnode_mdiobus_phy_device_register(struct mii_bus *mdio,
-- 
2.39.5




  parent reply	other threads:[~2024-12-23 16:18 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-23 15:58 [PATCH 6.1 00/83] 6.1.122-rc1 review Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 01/83] net: sched: fix ordering of qlen adjustment Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 02/83] PCI/AER: Disable AER service on suspend Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 03/83] PCI: Use preserve_config in place of pci_flags Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 04/83] PCI: vmd: Create domain symlink before pci_bus_add_devices() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 05/83] usb: cdns3: Add quirk flag to enable suspend residency Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 06/83] ASoC: Intel: sof_sdw: fix jack detection on ADL-N variant RVP Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 07/83] ASoC: Intel: sof_sdw: add quirk for Dell SKU 0B8C Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 08/83] PCI: Add ACS quirk for Broadcom BCM5760X NIC Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 09/83] MIPS: Loongson64: DTS: Fix msi node for ls7a Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 10/83] usb: dwc2: gadget: Dont write invalid mapped sg entries into dma_desc with iommu enabled Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 11/83] PCI: Introduce pci_resource_n() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 12/83] platform/x86: p2sb: Make p2sb_get_devfn() return void Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 13/83] p2sb: Factor out p2sb_read_from_cache() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 14/83] p2sb: Introduce the global flag p2sb_hidden_by_bios Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 15/83] p2sb: Move P2SB hide and unhide code to p2sb_scan_and_cache() Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 16/83] p2sb: Do not scan and remove the P2SB device when it is unhidden Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 17/83] i2c: pnx: Fix timeout in wait functions Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 18/83] cxl/region: Fix region creation for greater than x2 switches Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 19/83] net/smc: protect link down work from execute after lgr freed Greg Kroah-Hartman
2024-12-23 15:58 ` [PATCH 6.1 20/83] net/smc: check sndbuf_space again after NOSPACE flag is set in smc_poll Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 21/83] net/smc: check iparea_offset and ipv6_prefixes_cnt when receiving proposal msg Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 22/83] net/smc: check smcd_v2_ext_offset " Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 23/83] net/smc: check return value of sock_recvmsg when draining clc data Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 24/83] net: mscc: ocelot: fix incorrect IFH SRC_PORT field in ocelot_ifh_set_basic() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 25/83] netdevsim: prevent bad user input in nsim_dev_health_break_write() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 26/83] ionic: Fix netdev notifier unregister on failure Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 27/83] ionic: use ee->offset when returning sprom data Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 28/83] net: hinic: Fix cleanup in create_rxqs/txqs() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 29/83] net: ethernet: bgmac-platform: fix an OF node reference leak Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 30/83] netfilter: ipset: Fix for recursive locking warning Greg Kroah-Hartman
2024-12-23 15:59 ` Greg Kroah-Hartman [this message]
2024-12-23 15:59 ` [PATCH 6.1 32/83] mmc: sdhci-tegra: Remove SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC quirk Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 33/83] KVM: x86: Cache CPUID.0xD XSTATE offsets+sizes during module init Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 34/83] chelsio/chtls: prevent potential integer overflow on 32bit Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 35/83] i2c: riic: Always round-up when calculating bus period Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 36/83] efivarfs: Fix error on non-existent file Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 37/83] hexagon: Disable constant extender optimization for LLVM prior to 19.1.0 Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 38/83] USB: serial: option: add TCL IK512 MBIM & ECM Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 39/83] USB: serial: option: add MeiG Smart SLM770A Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 40/83] USB: serial: option: add Netprisma LCUK54 modules for WWAN Ready Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 41/83] USB: serial: option: add MediaTek T7XX compositions Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 42/83] USB: serial: option: add Telit FE910C04 rmnet compositions Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 43/83] thunderbolt: Improve redrive mode handling Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 44/83] drm/modes: Avoid divide by zero harder in drm_mode_vrefresh() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 45/83] drm/panel: novatek-nt35950: fix return value check in nt35950_probe() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 46/83] i915/guc: Reset engine utilization buffer before registration Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 47/83] i915/guc: Ensure busyness counter increases motonically Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 48/83] i915/guc: Accumulate active runtime on gt reset Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 49/83] drm/amdgpu: dont access invalid sched Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 50/83] hwmon: (tmp513) Dont use "proxy" headers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 51/83] hwmon: (tmp513) Simplify with dev_err_probe() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 52/83] hwmon: (tmp513) Use SI constants from units.h Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 53/83] hwmon: (tmp513) Fix interpretation of values of Shunt Voltage and Limit Registers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 54/83] hwmon: (tmp513) Fix Current Register value interpretation Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 55/83] hwmon: (tmp513) Fix interpretation of values of Temperature Result and Limit Registers Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 56/83] sh: clk: Fix clk_enable() to return 0 on NULL clk Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 57/83] zram: refuse to use zero sized block device as backing device Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 58/83] zram: fix uninitialized ZRAM not releasing " Greg Kroah-Hartman
2025-01-08  3:57   ` Sergey Senozhatsky
2024-12-23 15:59 ` [PATCH 6.1 59/83] btrfs: tree-checker: reject inline extent items with 0 ref count Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 60/83] Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 61/83] KVM: x86: Play nice with protected guests in complete_hypercall_exit() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 62/83] tracing: Fix test_event_printk() to process entire print argument Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 63/83] tracing: Add missing helper functions in event pointer dereference check Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 64/83] tracing: Add "%s" check in test_event_printk() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 65/83] selftests/bpf: Use asm constraint "m" for LoongArch Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 66/83] io_uring: Fix registered ring file refcount leak Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 67/83] io_uring: check if iowq is killed before queuing Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 68/83] NFS/pnfs: Fix a live lock between recalled layouts and layoutget Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 69/83] of/irq: Fix interrupt-map cell length check in of_irq_parse_imap_parent() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 70/83] of/irq: Fix using uninitialized variable @addr_len in API of_irq_parse_one() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 71/83] nilfs2: fix buffer head leaks in calls to truncate_inode_pages() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 72/83] nilfs2: prevent use of deleted inode Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 73/83] udmabuf: also check for F_SEAL_FUTURE_WRITE Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 74/83] of: Fix error path in of_parse_phandle_with_args_map() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 75/83] of: Fix refcount leakage for OF node returned by __of_get_dma_parent() Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 76/83] ceph: validate snapdirname option length when mounting Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 77/83] udf: Fix directory iteration for longer tail extents Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 78/83] epoll: Add synchronous wakeup support for ep_poll_callback Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 79/83] io_uring/rw: split io_read() into a helper Greg Kroah-Hartman
2024-12-23 15:59 ` [PATCH 6.1 80/83] io_uring/rw: treat -EOPNOTSUPP for IOCB_NOWAIT like -EAGAIN Greg Kroah-Hartman
2024-12-23 16:00 ` [PATCH 6.1 81/83] io_uring/rw: avoid punting to io-wq directly Greg Kroah-Hartman
2024-12-23 16:00 ` [PATCH 6.1 82/83] dt-bindings: net: fec: add pps channel property Greg Kroah-Hartman
2024-12-23 16:00 ` [PATCH 6.1 83/83] drm/amdgpu: Handle NULL bo->tbo.resource (again) in amdgpu_vm_bo_update Greg Kroah-Hartman
2024-12-23 21:14 ` [PATCH 6.1 00/83] 6.1.122-rc1 review SeongJae Park
2024-12-23 22:45 ` Shuah Khan
2024-12-24 10:24 ` Peter Schneider
2024-12-24 10:30 ` Ron Economos
2024-12-24 13:26 ` Jon Hunter
2024-12-24 19:49 ` Naresh Kamboju
2024-12-25  1:50 ` Zhao Mengmeng
2024-12-26 10:20 ` Muhammad Usama Anjum
2024-12-26 16:49 ` Florian Fainelli
2024-12-26 19:25 ` [PATCH 6.1] " Hardik Garg
2024-12-26 20:20 ` [PATCH 6.1 00/83] " 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=20241223155354.855533926@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=andrew@lunn.ch \
    --cc=joe@pf.is.s.u-tokyo.ac.jp \
    --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