aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-21 15:24:03 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-21 15:24:03 -0700
commit490fc053865c9cc40f1085ef8a5504f5341f79d2 (patch)
tree95f2e6e189cdae1a5e638b7ea4e39502605eaaa8 /kernel
parentmm: make vm_area_dup() actually copy the old vma data (diff)
downloadlinux-dev-490fc053865c9cc40f1085ef8a5504f5341f79d2.tar.xz
linux-dev-490fc053865c9cc40f1085ef8a5504f5341f79d2.zip
mm: make vm_area_alloc() initialize core fields
Like vm_area_dup(), it initializes the anon_vma_chain head, and the basic mm pointer. The rest of the fields end up being different for different users, although the plan is to also initialize the 'vm_ops' field to a dummy entry. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 67253e41bfb0..a191c05e757d 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -308,9 +308,15 @@ static struct kmem_cache *vm_area_cachep;
/* SLAB cache for mm_struct structures (tsk->mm) */
static struct kmem_cache *mm_cachep;
-struct vm_area_struct *vm_area_alloc(void)
+struct vm_area_struct *vm_area_alloc(struct mm_struct *mm)
{
- return kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
+ 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);
+ }
+ return vma;
}
struct vm_area_struct *vm_area_dup(struct vm_area_struct *orig)