[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220519150442.1289962-1-Liam.Howlett@oracle.com>
Date: Thu, 19 May 2022 15:04:50 +0000
From: Liam Howlett <liam.howlett@...cle.com>
To: "maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] mm/mmap: Avoid dereferencing next on null in BUG_ON()
Check there is a next before checking the bounds.
Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
---
mm/mmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/mmap.c b/mm/mmap.c
index 4279e2acd243..f1fc9c5c068b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -583,7 +583,7 @@ inline int vma_expand(struct ma_state *mas, struct vm_area_struct *vma,
}
/* Not merging but overwriting any part of next is not handled. */
- VM_BUG_ON(!remove_next && next != vma && end > next->vm_start);
+ VM_BUG_ON(next && !remove_next && next != vma && end > next->vm_start);
/* Only handles expanding */
VM_BUG_ON(vma->vm_start < start || vma->vm_end > end);
--
2.35.1
Powered by blists - more mailing lists