[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250116025005.55846-1-liuye@kylinos.cn>
Date: Thu, 16 Jan 2025 10:50:05 +0800
From: Liu Ye <liuye@...inos.cn>
To: akpm@...ux-foundation.org,
Liam.Howlett@...cle.com,
lorenzo.stoakes@...cle.com
Cc: jannh@...gle.com,
vbabka@...e.cz,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Liu Ye <liuye@...inos.cn>
Subject: [PATCH] mm/vma: Add VM_WARN_ON for commit_merge
Add VM_WARN_ON to prevent 'adjust' from accessing NULL pointers
when 'adjust' is NULL and 'expanded' is false or 'adj_start' is
not zero.
Signed-off-by: Liu Ye <liuye@...inos.cn>
---
mm/vma.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/mm/vma.c b/mm/vma.c
index 31c9c6f51c9f..36b5ac675504 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -641,6 +641,7 @@ static int commit_merge(struct vma_merge_struct *vmg,
init_multi_vma_prep(&vp, vmg->vma, adjust, remove, remove2);
+ VM_WARN_ON(!adjust && (!expanded || adj_start));
VM_WARN_ON(vp.anon_vma && adjust && adjust->anon_vma &&
vp.anon_vma != adjust->anon_vma);
--
2.25.1
Powered by blists - more mailing lists