Re: [syzbot] [xfs?] [mm?] WARNING: bad unlock balance in __mm_populate

From: Edward Adam Davis
Date: Mon Mar 03 2025 - 21:06:41 EST


#syz test

diff --git a/mm/gup.c b/mm/gup.c
index 3883b307780e..4caa7c635320 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1998,7 +1998,11 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
struct vm_area_struct *vma = NULL;
int locked = 0;
long ret = 0;
+ static char poping = 0;

+ if (poping)
+ return 0;
+ poping = 1;
end = start + len;

for (nstart = start; nstart < end; nstart = nend) {
@@ -2042,6 +2046,7 @@ int __mm_populate(unsigned long start, unsigned long len, int ignore_errors)
}
if (locked)
mmap_read_unlock(mm);
+ poping = 0;
return ret; /* 0 or negative error code */
}
#else /* CONFIG_MMU */