Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm: introduce vma_init()" failed to apply to 4.17-stable tree

PATCH [email protected] 1 participant 1 message Jul 28, 2018

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.17-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

Quoted 1 line

From 027232da7c7c1c7f04383f93bd798e475dde5285 Mon Sep 17 00:00:00 2001

From: "Kirill A. Shutemov" <[email protected]>
Date: Thu, 26 Jul 2018 16:37:25 -0700
Subject: [PATCH] mm: introduce vma_init()

Not all VMAs allocated with vm_area_alloc(). Some of them allocated on stack or in data segment.

The new helper can be use to initialize VMA properly regardless where it was allocated.

include/linux/mm.h +6 -0
index d3a3842316b8..31540f166987 100644
@@ -452,6 +452,12 @@ struct vm_operations_struct {
 					  unsigned long addr);
 };
 
+static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm)
+{
+	vma->vm_mm = mm;
+	INIT_LIST_HEAD(&vma->anon_vma_chain);
+}
+
 struct mmu_gather;
 struct inode;
 
kernel/fork.c +2 -4
index a191c05e757d..1b27babc4c78 100644
@@ -312,10 +312,8 @@ struct vm_area_struct *vm_area_alloc(struct mm_struct *mm)
 {
 	struct vm_area_struct *vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
 
-	if (vma) {
-		vma->vm_mm = mm;
-		INIT_LIST_HEAD(&vma->anon_vma_chain);
-	}
+	if (vma)
+		vma_init(vma, mm);
 	return vma;
 }