[BACKPORT,4.4.y,12/25] mm/rmap: replace BUG_ON(anon_vma->degree) with VM_WARN_ON

Message ID 20190322154425.3852517-13-arnd@arndb.de
State New
Headers show
  • [BACKPORT,4.4.y,01/25] mmc: pwrseq: constify mmc_pwrseq_ops structures
Related show

Commit Message

Arnd Bergmann March 22, 2019, 3:44 p.m.
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

This check effectively catches anon vma hierarchy inconsistence and some
vma corruptions.  It was effective for catching corner cases in anon vma
reusing logic.  For now this code seems stable so check could be hidden
under CONFIG_DEBUG_VM and replaced with WARN because it's not so fatal.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>

Suggested-by: Vasily Averin <vvs@virtuozzo.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

(cherry picked from commit e4c5800a3991f0c6a766983535dfc10d51802cf6)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

 mm/rmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



diff --git a/mm/rmap.c b/mm/rmap.c
index 488dda209431..cf733fab230f 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -408,7 +408,7 @@  void unlink_anon_vmas(struct vm_area_struct *vma)
 	list_for_each_entry_safe(avc, next, &vma->anon_vma_chain, same_vma) {
 		struct anon_vma *anon_vma = avc->anon_vma;
-		BUG_ON(anon_vma->degree);
+		VM_WARN_ON(anon_vma->degree);