Skip to contentSkip to conversation

m68k-sun3-add-check-for-__pgd_alloc.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Mar 6, 2025 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: m68k: sun3: add check for __pgd_alloc()
has been removed from the -mm tree. Its filename was

     m68k-sun3-add-check-for-__pgd_alloc.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Haoxiang Li <[email protected]>
Subject: m68k: sun3: add check for __pgd_alloc()
Date: Tue, 18 Feb 2025 00:00:17 +0800

Add check for the return value of __pgd_alloc() in pgd_alloc() to prevent null pointer dereference.

Fixes a9b3c355c2e6 ("asm-generic: pgalloc: provide generic __pgd_{alloc,free}")
Cc Dave Hansen <[email protected]>
Cc Kevin Brodsky <[email protected]>
Cc Qi Zheng <[email protected]>
Cc Sam Creasey <[email protected]>

---

 arch/m68k/include/asm/sun3_pgalloc.h |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/m68k/include/asm/sun3_pgalloc.h renamed from arch/m68k/include/asm/sun3_pgalloc.h~m68k-sun3-add-check-for-__pgd_alloc +4 -2
@@ -44,8 +44,10 @@ static inline pgd_t * pgd_alloc(struct m
 	pgd_t *new_pgd;
 
 	new_pgd = __pgd_alloc(mm, 0);
-	memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
-	memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT));
+	if (likely(new_pgd != NULL)) {
+		memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE);
+		memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT));
+	}
 	return new_pgd;
 }
 

_

Patches currently in -mm which might be from [email protected] are