From: Martin Weiss <martin.githubacc@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Martin Weiss <Martin.weiss2410@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jason Baron <jbaron@akamai.com>,
Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH 1/4] lib/dynamic_debug: add NULL check after kstrdup
Date: Mon, 29 Jun 2026 16:30:51 +0700 [thread overview]
Message-ID: <20260629093056.591498-1-Martin.weiss2410@gmail.com> (raw)
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
next reply other threads:[~2026-06-29 9:31 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 9:30 Martin Weiss [this message]
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
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=20260629093056.591498-1-Martin.weiss2410@gmail.com \
--to=martin.githubacc@gmail.com \
--cc=Martin.weiss2410@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jbaron@akamai.com \
--cc=jim.cromie@gmail.com \
--cc=linux-kernel@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®