mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] i3c: master: Fix of_node reference leak in i3c_master_register()
@ 2026-09-16 16:03 Wentao Liang
       [not found] ` <20260916161616.7B6B31F000FF@smtp.kernel.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16 16:03 UTC (permalink / raw)
  To: Frank.Li
  Cc: alexandre.belloni, arnd, bbrezillon, gregkh, linux-i3c,
	linux-kernel, Wentao Liang, stable

The reference taken on the parent's device node with of_node_get() is
normally dropped by i3c_masterdev_release() once the master device is
unregistered. When i3c_master_rpm_get() fails, the function returns
before device_initialize(), so put_device() is never called and the
node reference is leaked.

Release the device node reference on the runtime PM failure path.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/i3c/master.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 5cd4e5da2233..23f490a00591 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -3033,8 +3033,10 @@ int i3c_master_register(struct i3c_master_controller *master,
 	INIT_LIST_HEAD(&master->boardinfo.i3c);
 
 	ret = i3c_master_rpm_get(master);
-	if (ret)
+	if (ret) {
+		of_node_put(master->dev.of_node);
 		return ret;
+	}
 
 	device_initialize(&master->dev);
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-08  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 16:03 [PATCH] i3c: master: Fix of_node reference leak in i3c_master_register() Wentao Liang
     [not found] ` <20260916161616.7B6B31F000FF@smtp.kernel.org>
     [not found]   ` <aqr19zvkGvMqRi2B@lizhi-Precision-Tower-5810>
2026-11-08  9:28     ` Wentao Liang

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®