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

From: Hillf Danton
Date: Thu Apr 04 2024 - 07:45:37 EST


On Thu, 04 Apr 2024 03:56:24 -0700
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 727900b675b7 Add linux-next specific files for 20240403
> git tree: linux-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13764a3d180000

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 727900b675b7

--- x/mm/madvise.c
+++ y/mm/madvise.c
@@ -482,10 +482,7 @@ restart:
err = split_folio(folio);
folio_unlock(folio);
folio_put(folio);
- if (err)
- continue;
- start_pte = pte =
- pte_offset_map_lock(mm, pmd, addr, &ptl);
+ start_pte = pte = pte_offset_map_lock(mm, pmd, addr, &ptl);
if (!start_pte)
break;
arch_enter_lazy_mmu_mode();
--