[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251129142042.344359-4-richard@nod.at>
Date: Sat, 29 Nov 2025 15:20:41 +0100
From: Richard Weinberger <richard@....at>
To: linux-kernel@...r.kernel.org
Cc: linux-omap@...r.kernel.org,
devicetree@...r.kernel.org,
arnd@...db.de,
lee@...nel.org,
dakr@...nel.org,
rafael@...nel.org,
gregkh@...uxfoundation.org,
broonie@...nel.org,
tony@...mide.com,
rogerq@...nel.org,
khilman@...libre.com,
andreas@...nade.info,
aaro.koskinen@....fi,
conor+dt@...nel.org,
krzk+dt@...nel.org,
robh@...nel.org,
Richard Weinberger <richard@....at>
Subject: [PATCH 3/4] syscon: Wire up has-inaccessible-regs
Evaluate the has-inaccessible-regs device tree property to disable
debugfs access if a register map contains dangerous/harmful registers.
Signed-off-by: Richard Weinberger <richard@....at>
---
drivers/mfd/syscon.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index ae71a2710bed8..73fff0df3f42f 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -70,6 +70,16 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)
else if (of_property_read_bool(np, "native-endian"))
syscon_config.val_format_endian = REGMAP_ENDIAN_NATIVE;
+
+ /*
+ * Disable debugfs access if a register map has various inaccessible
+ * registers.
+ * In such a case the device driver has to know exactly how and when
+ * access is allowed but general access via userspace can cause harm.
+ */
+ if (of_property_read_bool(np, "has-inaccessible-regs"))
+ syscon_config.debugfs_disable = true;
+
/*
* search for reg-io-width property in DT. If it is not provided,
* default to 4 bytes. regmap_init_mmio will return an error if values
--
2.51.0
Powered by blists - more mailing lists