+ mm-debug_page_alloc-fix-null-buf-in-debug_guardpage_minorder_setup.patch added to mm-new branch
Andrew Morton <[email protected]>
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The patch titled
Subject: mm: debug_page_alloc: fix NULL buf in debug_guardpage_minorder_setup
has been added to the -mm mm-new branch. Its filename is
mm-debug_page_alloc-fix-null-buf-in-debug_guardpage_minorder_setup.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-debug_page_alloc-fix-null-buf-in-debug_guardpage_minorder_setup.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
If a few days of testing in mm-new is successful, the patch will me moved
into mm.git's mm-unstable branch, which is included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Ye Liu <[email protected]>
Subject: mm: debug_page_alloc: fix NULL buf in debug_guardpage_minorder_setup
Date: Thu, 6 Aug 2026 08:45:55 +0800
If the kernel command line includes "debug_guardpage_minorder" without an
equals sign (i.e., no value is provided), the early parameter parser
passes a NULL buf pointer to the setup function.
kstrtouint() does not perform a NULL check on its input and calls directly
into kstrtoull() which dereferences s[0] unconditionally, leading to a
NULL pointer dereference and early boot crash.
Additionally, the error path's pr_err("%s", buf) would also crash with a
NULL format argument.
Link: https://lore.kernel.org/[email protected]
Fixes: c0a32fc5a2e4 ("mm: more intensive memory corruption debugging")
Signed-off-by: Ye Liu <[email protected]>
Acked-by: Zi Yan <[email protected]>
Reviewed-by: John Hubbard <[email protected]>
Reviewed-by: Andrew Morton <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
mm/debug_page_alloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/mm/debug_page_alloc.c~mm-debug_page_alloc-fix-null-buf-in-debug_guardpage_minorder_setup
+++ a/mm/debug_page_alloc.c
@@ -22,8 +22,8 @@ static int __init debug_guardpage_minord
{
unsigned int res;
- if (kstrtouint(buf, 10, &res) < 0 || res > MAX_PAGE_ORDER / 2) {
- pr_err("Bad debug_guardpage_minorder value: %s\n", buf);
+ if (!buf || kstrtouint(buf, 10, &res) < 0 || res > MAX_PAGE_ORDER / 2) {
+ pr_err("Bad debug_guardpage_minorder value: %s\n", buf ?: "(missing)");
return 0;
}
_debug_guardpage_minorder = res;
_
Patches currently in -mm which might be from [email protected] are
mm-debug_page_alloc-fix-type-mismatch-for-debug_guardpage_minorder.patch
mm-show_mem-fix-format-string-inconsistencies-and-type-mismatches.patch
mm-debug_page_alloc-fix-null-buf-in-debug_guardpage_minorder_setup.patch