mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/4] lib/dynamic_debug: add NULL check after kstrdup
@ 2026-06-29  9:30 Martin Weiss
  2026-06-29  9:30 ` [PATCH 2/4] selftests: filesystems: fix spelling mistake in statmount test Martin Weiss
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Martin Weiss @ 2026-06-29  9:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Martin Weiss, Andrew Morton, Jason Baron, Jim Cromie

kstrdup(saved_command_line, GFP_KERNEL) may return NULL under memory
pressure. Add a check to avoid NULL pointer dereference during boot-time
dynamic debug parameter parsing.

Signed-off-by: Martin Weiss <Martin.weiss2410@gmail.com>
---
 lib/dynamic_debug.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index 18a71a9108d3..59a04057b509 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1479,6 +1479,8 @@ static int __init dynamic_debug_init(void)
 	 * slightly noisy if verbose, but harmless.
 	 */
 	cmdline = kstrdup(saved_command_line, GFP_KERNEL);
+	if (!cmdline)
+		return 0; /* prevents a boot-time NULL deref */
 	parse_args("dyndbg params", cmdline, NULL,
 		   0, 0, 0, NULL, &ddebug_dyndbg_boot_param_cb);
 	kfree(cmdline);
-- 
2.54.0


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

end of thread, other threads:[~2026-06-29 23:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-29  9:30 [PATCH 1/4] lib/dynamic_debug: add NULL check after kstrdup Martin Weiss
2026-06-29  9:30 ` [PATCH 2/4] selftests: filesystems: fix spelling mistake in statmount test Martin Weiss
2026-06-29  9:30 ` [PATCH 3/4] selftests: powerpc: fix spelling mistake Martin Weiss
2026-06-29  9:30 ` [PATCH 4/4] tools/build: fix spelling mistake in documentation Martin Weiss
2026-06-29 23:51 ` [PATCH 1/4] lib/dynamic_debug: add NULL check after kstrdup Andrew Morton

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®