From: <gregkh@linuxfoundation.org>
To: m.szyprowski@samsung.com,pjw@kernel.org
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] riscv: mm: reserve the DTB before scanning reserved memory" failed to apply to 6.12-stable tree
Date: Wed, 02 Dec 2026 14:41:30 +0100 [thread overview]
Message-ID: <2026120230-stroller-atypical-3eb0@gregkh> (raw)
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x fc91dacd0c2b4f9ca7e0ce30016f5aee6256cba5
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120230-stroller-atypical-3eb0@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From fc91dacd0c2b4f9ca7e0ce30016f5aee6256cba5 Mon Sep 17 00:00:00 2001
From: Marek Szyprowski <m.szyprowski@samsung.com>
Date: Wed, 4 Nov 2026 11:46:03 +0100
Subject: [PATCH] riscv: mm: reserve the DTB before scanning reserved memory
early_init_fdt_scan_reserved_mem() allocates memory from memblock while
it scans /reserved-memory: the reserved_mem array, and the regions that
are placed dynamically by size. On RISC-V the DTB was only reserved
after that scan, so memblock could hand out the memory the DTB occupies
while the DTB was still being parsed.
Reserve the DTB before the scan, so that memblock never allocates from
it.
Fixes: ef69d2559fe9 ("riscv: Move early dtb mapping into the fixmap region")
Closes: https://lore.kernel.org/all/b71ac175-fba5-4f61-bbdb-0b98dec9ccee@samsung.com/
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://patch.msgid.link/20261104104604.3370384-1-m.szyprowski@samsung.com
Cc: stable@vger.kernel.org
Signed-off-by: Paul Walmsley <pjw@kernel.org>
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 070ee69eabb3..d73688402b50 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -294,13 +294,6 @@ static void __init setup_bootmem(void)
reserve_initrd_mem();
- /*
- * No allocation should be done before reserving the memory as defined
- * in the device tree, otherwise the allocation could end up in a
- * reserved region.
- */
- early_init_fdt_scan_reserved_mem();
-
/*
* If DTB is built in, no need to reserve its memblock.
* Otherwise, do reserve it but avoid using
@@ -309,6 +302,13 @@ static void __init setup_bootmem(void)
*/
if (!IS_ENABLED(CONFIG_BUILTIN_DTB))
memblock_reserve(dtb_early_pa, fdt_totalsize(dtb_early_va));
+
+ /*
+ * No allocation should be done before reserving the memory as defined
+ * in the device tree, otherwise the allocation could end up in a
+ * reserved region.
+ */
+ early_init_fdt_scan_reserved_mem();
}
#ifdef CONFIG_RELOCATABLE
reply other threads:[~2026-12-02 14:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=2026120230-stroller-atypical-3eb0@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=m.szyprowski@samsung.com \
--cc=pjw@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.