[PATCH] fsi: master-gpio: Fix of_node reference leak in fsi_master_gpio_probe()
From: Wentao Liang
Date: Wed Sep 16 2026 - 05:58:27 EST
In fsi_master_gpio_probe(), a reference to the device tree node is
taken with of_node_get() and stored in master.dev.of_node. If one of
the GPIO requests or the device_create_file() call fails, the error
path frees the master without putting that reference, leaking it.
Put the device node reference before freeing the master on the error
path. of_node_put() tolerates a NULL node, so paths with no device
tree node are unaffected.
Fixes: f6a2f8eb73f0 ("fsi: Match fsi slaves and engines to available dt nodes")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
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 0884e143b30e..03c46f9d6543 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(dev_of_node(master->master.dev));
kfree(master);
return rc;
}
--
2.34.1