[merged mm-hotfixes-stable] selftests-mm-fix-potential-wild-pointer-access-of-getline-due-to-missing-init.patch removed from -mm tree
Andrew Morton <[email protected]> Tue, 28 Jul 2026 17:38:16 -0700
| Newsgroups | org.kernel.vger.mm-commits,org.kernel.vger.stable |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: selftests/mm: fix potential wild pointer access of getline due to missing init
has been removed from the -mm tree. Its filename was
selftests-mm-fix-potential-wild-pointer-access-of-getline-due-to-missing-init.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: Chris Gellermann <[email protected]>
Subject: selftests/mm: fix potential wild pointer access of getline due to missing init
Date: Wed, 22 Jul 2026 15:02:46 +0200
This is another occurrence of using getline where the code assumes that
getline allocates memory to store the line, but the pointer passed to it
is uninitialized and potentially a non-null pointer. This violates the
Open Group Spec[1] and caused a segfault in a similar situation in
selftest/clone3/clone3_set_tid. Fix it by initializing the line pointer
to NULL.
The issue has been found by simply grepping through the selftest code
after running into the issue in clone3_set_tid. Whether it segfaults in
its current state is unknown to me. But it's good to be addressed due to
defensive reasons.
Link: https://lore.kernel.org/[email protected]
Link: https://pubs.opengroup.org/onlinepubs/9799919799/functions/getline.html [1]
Fixes: 26b4224d9961 ("selftests: expanding more mlock selftest")
Signed-off-by: Chris Gellermann <[email protected]>
Acked-by: David Hildenbrand (arm) <[email protected]>
Reviewed-by: Lorenzo Stoakes <[email protected]>
Cc: Christian Brauner <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
tools/testing/selftests/mm/mlock-random-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/tools/testing/selftests/mm/mlock-random-test.c~selftests-mm-fix-potential-wild-pointer-access-of-getline-due-to-missing-init
+++ a/tools/testing/selftests/mm/mlock-random-test.c
@@ -84,7 +84,7 @@ int get_proc_locked_vm_size(void)
int get_proc_page_size(unsigned long addr)
{
FILE *smaps;
- char *line;
+ char *line = NULL;
unsigned long mmupage_size = 0;
size_t size;
_
Patches currently in -mm which might be from [email protected] are