All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/mmap: Avoid dereferencing next on null in BUG_ON()
@ 2022-05-19 15:04 Liam Howlett
  0 siblings, 0 replies; only message in thread
From: Liam Howlett @ 2022-05-19 15:04 UTC (permalink / raw)
  To: maple-tree, linux-mm, linux-kernel, Andrew Morton

Check there is a next before checking the bounds.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-19 15:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 15:04 [PATCH] mm/mmap: Avoid dereferencing next on null in BUG_ON() Liam Howlett

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.