mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiale Yao <yaojiale02@163.com>
To: Gatien Chevallier <gatien.chevallier@foss.st.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: [PATCH 3/3] bus: stm32-rifsc: reject debugfs setup without match data
Date: Tue, 20 Oct 2026 17:36:35 +0800	[thread overview]
Message-ID: <20261020093637.1654161-4-yaojiale02@163.com> (raw)
In-Reply-To: <20261020093637.1654161-1-yaojiale02@163.com>

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@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 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


      parent reply	other threads:[~2026-10-20  9:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  9:36 [PATCH 0/3] bus: reject devices without platform " Jiale Yao
2026-10-20  9:36 ` [PATCH 1/3] bus: imx-aipstz: reject devices without " Jiale Yao
2026-10-20 16:04   ` Frank Li
2026-10-20  9:36 ` [PATCH 2/3] bus: imx-weim: " Jiale Yao
2026-10-20 16:06   ` Frank Li
2026-10-20  9:36 ` Jiale Yao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261020093637.1654161-4-yaojiale02@163.com \
    --to=yaojiale02@163.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=gatien.chevallier@foss.st.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®