mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fsi: master-gpio: Fix reference count leak in probe error path
@ 2025-12-08  3:36 Wentao Liang
  2025-12-08 15:10 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-12-08  3:36 UTC (permalink / raw)
  To: eajames, ninad; +Cc: linux-fsi, linux-kernel, Wentao Liang, stable

The function of_node_get() returns a node pointer with its refcount
incremented, but in the error path of the fsi_master_gpio_probe(),
this reference is not released before freeing the master structure,
causing a refcount leak.

Add the missing of_node_put() in the error handling path to properly
release the device tree node reference.

Fixes: 8ef9ccf81044 ("fsi: master-gpio: Add missing release function")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/fsi/fsi-master-gpio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
index 69de0b5b9cbd..ae9e156284d0 100644
--- a/drivers/fsi/fsi-master-gpio.c
+++ b/drivers/fsi/fsi-master-gpio.c
@@ -861,6 +861,7 @@ static int fsi_master_gpio_probe(struct platform_device *pdev)
 	}
 	return 0;
  err_free:
+	of_node_put(master->master.dev.of_node);
 	kfree(master);
 	return rc;
 }
-- 
2.34.1


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

end of thread, other threads:[~2025-12-08 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08  3:36 [PATCH] fsi: master-gpio: Fix reference count leak in probe error path Wentao Liang
2025-12-08 15:10 ` Markus Elfring

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®