mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] of: module: harden a call to request_module
@ 2026-09-14 12:24 Dmitriy Okunev
  2026-09-16 20:16 ` Rob Herring
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitriy Okunev @ 2026-09-14 12:24 UTC (permalink / raw)
  To: Rob Herring, Frank Rowand
  Cc: lvc-project, Stephen Boyd, Peter Chen, devicetree, linux-kernel

In of_request_module(), the string 'str' is built from Device Tree data
and passed directly to request_module() as a format string.  While the
Device Tree is generally considered trusted, using externally provided
data as a format string is fragile and can lead to unintended format
specifier interpretation. 

Fix this by using request_module("%s", str) to treat 'str' as a plain
string argument, not a format string.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 9c829c097f2f1 ("of: device: Support loading a module with OF based modalias")
Signed-off-by: Dmitriy Okunev <dokunevdmitriy@gmail.com>
---
 drivers/of/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/module.c b/drivers/of/module.c
index 1e735fc130ad..592377603c24 100644
--- a/drivers/of/module.c
+++ b/drivers/of/module.c
@@ -73,7 +73,7 @@ int of_request_module(const struct device_node *np)
 
 	of_modalias(np, str, size);
 	str[size - 1] = '\0';
-	ret = request_module(str);
+	ret = request_module("%s", str);
 	kfree(str);
 
 	return ret;
-- 
2.53.0


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

end of thread, other threads:[~2026-09-16 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-14 12:24 [PATCH] of: module: harden a call to request_module Dmitriy Okunev
2026-09-16 20:16 ` Rob Herring

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®