[PATCH 3/3] bus: stm32-rifsc: reject debugfs setup without match data
From: Jiale Yao
Date: Tue Oct 20 2026 - 05:41:18 EST
Platform driver_override can bind a device to this driver without a
matching OF entry. With debugfs enabled, of_device_get_match_data()
then returns NULL and the configuration dump dereferences the resource
name table.
Reject debugfs registration without match data before exposing the
configuration file.
Fixes: 3bae4748c1cdd ("bus: rifsc: add debugfs entry to dump the firewall configuration")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Jiale Yao <yaojiale02@xxxxxxx>
---
drivers/bus/stm32_rifsc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bus/stm32_rifsc.c b/drivers/bus/stm32_rifsc.c
index 19d10379dcef..dd008103b9c1 100644
--- a/drivers/bus/stm32_rifsc.c
+++ b/drivers/bus/stm32_rifsc.c
@@ -617,6 +617,8 @@ static int stm32_rifsc_register_debugfs(struct stm32_firewall_controller *rifsc_
rifsc_priv->nb_rimu = nb_rimu;
rifsc_priv->nb_risal = nb_risal;
rifsc_priv->res_names = of_device_get_match_data(rifsc_controller->dev);
+ if (!rifsc_priv->res_names)
+ return -ENODATA;
root = debugfs_lookup("stm32_firewall", NULL);
if (!root)
--
2.34.1