aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-07-27 13:30:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-07-27 13:30:47 -0400
commit864af0d40cdc82b705e3ca79cf2a57be900954b1 (patch)
tree6d051c30ba9734e7e6dea684a4df1f8bfc24a373
parent1a3d8691fd2ae95f5443b2d57f91f28f6ff4700d (diff)
parentd97e5e6160c0e0a23963ec198c7cb1c69e6bf9e8 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge misc fixes from Andrew Morton: "11 fixes" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: kvm, mm: account shadow page tables to kmemcg zswap: re-check zswap_is_full() after do zswap_shrink() include/linux/eventfd.h: include linux/errno.h mm: fix vma_is_anonymous() false-positives mm: use vma_init() to initialize VMAs on stack and data segments mm: introduce vma_init() mm: fix exports that inadvertently make put_page() EXPORT_SYMBOL_GPL ipc/sem.c: prevent queue.status tearing in semop mm: disallow mappings that conflict for devm_memremap_pages() kasan: only select SLUB_DEBUG with SYSFS=y delayacct: fix crash in delayacct_blkio_end() after delayacct init failure
-rw-r--r--arch/arm/kernel/process.c1
-rw-r--r--arch/arm/mach-rpc/ecard.c2
-rw-r--r--arch/arm64/include/asm/tlb.h4
-rw-r--r--arch/arm64/mm/hugetlbpage.c7
-rw-r--r--arch/ia64/include/asm/tlb.h2
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/x86/kvm/mmu.c2
-rw-r--r--arch/x86/um/mem_32.c2
-rw-r--r--drivers/char/mem.c1
-rw-r--r--fs/exec.c1
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--include/linux/delayacct.h2
-rw-r--r--include/linux/eventfd.h1
-rw-r--r--include/linux/mm.h14
-rw-r--r--ipc/sem.c2
-rw-r--r--kernel/fork.c6
-rw-r--r--kernel/memremap.c22
-rw-r--r--lib/Kconfig.kasan2
-rw-r--r--mm/mempolicy.c1
-rw-r--r--mm/mmap.c3
-rw-r--r--mm/nommu.c2
-rw-r--r--mm/shmem.c1
-rw-r--r--mm/zswap.c9
23 files changed, 73 insertions, 18 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 225d1c58d2de..d9c299133111 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -338,6 +338,7 @@ static struct vm_area_struct gate_vma = {
338 338
339static int __init gate_vma_init(void) 339static int __init gate_vma_init(void)
340{ 340{
341 vma_init(&gate_vma, NULL);
341 gate_vma.vm_page_prot = PAGE_READONLY_EXEC; 342 gate_vma.vm_page_prot = PAGE_READONLY_EXEC;
342 return 0; 343 return 0;
343} 344}
diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index 39aef4876ed4..8db62cc54a6a 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -237,8 +237,8 @@ static void ecard_init_pgtables(struct mm_struct *mm)
237 237
238 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE)); 238 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
239 239
240 vma_init(&vma, mm);
240 vma.vm_flags = VM_EXEC; 241 vma.vm_flags = VM_EXEC;
241 vma.vm_mm = mm;
242 242
243 flush_tlb_range(&vma, IO_START, IO_START + IO_SIZE); 243 flush_tlb_range(&vma, IO_START, IO_START + IO_SIZE);
244 flush_tlb_range(&vma, EASI_START, EASI_START + EASI_SIZE); 244 flush_tlb_range(&vma, EASI_START, EASI_START + EASI_SIZE);
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index ffdaea7954bb..d87f2d646caa 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -37,7 +37,9 @@ static inline void __tlb_remove_table(void *_table)
37 37
38static inline void tlb_flush(struct mmu_gather *tlb) 38static inline void tlb_flush(struct mmu_gather *tlb)
39{ 39{
40 struct vm_area_struct vma = { .vm_mm = tlb->mm, }; 40 struct vm_area_struct vma;
41
42 vma_init(&vma, tlb->mm);
41 43
42 /* 44 /*
43 * The ASID allocator will either invalidate the ASID or mark 45 * The ASID allocator will either invalidate the ASID or mark
diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index ecc6818191df..1854e49aa18a 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -108,11 +108,13 @@ static pte_t get_clear_flush(struct mm_struct *mm,
108 unsigned long pgsize, 108 unsigned long pgsize,
109 unsigned long ncontig) 109 unsigned long ncontig)
110{ 110{
111 struct vm_area_struct vma = { .vm_mm = mm }; 111 struct vm_area_struct vma;
112 pte_t orig_pte = huge_ptep_get(ptep); 112 pte_t orig_pte = huge_ptep_get(ptep);
113 bool valid = pte_valid(orig_pte); 113 bool valid = pte_valid(orig_pte);
114 unsigned long i, saddr = addr; 114 unsigned long i, saddr = addr;
115 115
116 vma_init(&vma, mm);
117
116 for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) { 118 for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) {
117 pte_t pte = ptep_get_and_clear(mm, addr, ptep); 119 pte_t pte = ptep_get_and_clear(mm, addr, ptep);
118 120
@@ -145,9 +147,10 @@ static void clear_flush(struct mm_struct *mm,
145 unsigned long pgsize, 147 unsigned long pgsize,
146 unsigned long ncontig) 148 unsigned long ncontig)
147{ 149{
148 struct vm_area_struct vma = { .vm_mm = mm }; 150 struct vm_area_struct vma;
149 unsigned long i, saddr = addr; 151 unsigned long i, saddr = addr;
150 152
153 vma_init(&vma, mm);
151 for (i = 0; i < ncontig; i++, addr += pgsize, ptep++) 154 for (i = 0; i < ncontig; i++, addr += pgsize, ptep++)
152 pte_clear(mm, addr, ptep); 155 pte_clear(mm, addr, ptep);
153 156
diff --git a/arch/ia64/include/asm/tlb.h b/arch/ia64/include/asm/tlb.h
index 44f0ac0df308..db89e7306081 100644
--- a/arch/ia64/include/asm/tlb.h
+++ b/arch/ia64/include/asm/tlb.h
@@ -120,7 +120,7 @@ ia64_tlb_flush_mmu_tlbonly(struct mmu_gather *tlb, unsigned long start, unsigned
120 */ 120 */
121 struct vm_area_struct vma; 121 struct vm_area_struct vma;
122 122
123 vma.vm_mm = tlb->mm; 123 vma_init(&vma, tlb->mm);
124 /* flush the address range from the tlb: */ 124 /* flush the address range from the tlb: */
125 flush_tlb_range(&vma, start, end); 125 flush_tlb_range(&vma, start, end);
126 /* now flush the virt. page-table area mapping the address range: */ 126 /* now flush the virt. page-table area mapping the address range: */
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index bdb14a369137..e6c6dfd98de2 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -273,7 +273,7 @@ static struct vm_area_struct gate_vma;
273 273
274static int __init gate_vma_init(void) 274static int __init gate_vma_init(void)
275{ 275{
276 gate_vma.vm_mm = NULL; 276 vma_init(&gate_vma, NULL);
277 gate_vma.vm_start = FIXADDR_USER_START; 277 gate_vma.vm_start = FIXADDR_USER_START;
278 gate_vma.vm_end = FIXADDR_USER_END; 278 gate_vma.vm_end = FIXADDR_USER_END;
279 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; 279 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index d594690d8b95..6b8f11521c41 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -890,7 +890,7 @@ static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache,
890 if (cache->nobjs >= min) 890 if (cache->nobjs >= min)
891 return 0; 891 return 0;
892 while (cache->nobjs < ARRAY_SIZE(cache->objects)) { 892 while (cache->nobjs < ARRAY_SIZE(cache->objects)) {
893 page = (void *)__get_free_page(GFP_KERNEL); 893 page = (void *)__get_free_page(GFP_KERNEL_ACCOUNT);
894 if (!page) 894 if (!page)
895 return -ENOMEM; 895 return -ENOMEM;
896 cache->objects[cache->nobjs++] = page; 896 cache->objects[cache->nobjs++] = page;
diff --git a/arch/x86/um/mem_32.c b/arch/x86/um/mem_32.c
index 744afdc18cf3..56c44d865f7b 100644
--- a/arch/x86/um/mem_32.c
+++ b/arch/x86/um/mem_32.c
@@ -16,7 +16,7 @@ static int __init gate_vma_init(void)
16 if (!FIXADDR_USER_START) 16 if (!FIXADDR_USER_START)
17 return 0; 17 return 0;
18 18
19 gate_vma.vm_mm = NULL; 19 vma_init(&gate_vma, NULL);
20 gate_vma.vm_start = FIXADDR_USER_START; 20 gate_vma.vm_start = FIXADDR_USER_START;
21 gate_vma.vm_end = FIXADDR_USER_END; 21 gate_vma.vm_end = FIXADDR_USER_END;
22 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC; 22 gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index ffeb60d3434c..df66a9dd0aae 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -708,6 +708,7 @@ static int mmap_zero(struct file *file, struct vm_area_struct *vma)
708#endif 708#endif
709 if (vma->vm_flags & VM_SHARED) 709 if (vma->vm_flags & VM_SHARED)
710 return shmem_zero_setup(vma); 710 return shmem_zero_setup(vma);
711 vma_set_anonymous(vma);
711 return 0; 712 return 0;
712} 713}
713 714
diff --git a/fs/exec.c b/fs/exec.c
index 72e961a62adb..bdd0eacefdf5 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -293,6 +293,7 @@ static int __bprm_mm_init(struct linux_binprm *bprm)
293 bprm->vma = vma = vm_area_alloc(mm); 293 bprm->vma = vma = vm_area_alloc(mm);
294 if (!vma) 294 if (!vma)
295 return -ENOMEM; 295 return -ENOMEM;
296 vma_set_anonymous(vma);
296 297
297 if (down_write_killable(&mm->mmap_sem)) { 298 if (down_write_killable(&mm->mmap_sem)) {
298 err = -EINTR; 299 err = -EINTR;
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index d508c7844681..40d4c66c7751 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -411,6 +411,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
411 bool truncate_op = (lend == LLONG_MAX); 411 bool truncate_op = (lend == LLONG_MAX);
412 412
413 memset(&pseudo_vma, 0, sizeof(struct vm_area_struct)); 413 memset(&pseudo_vma, 0, sizeof(struct vm_area_struct));
414 vma_init(&pseudo_vma, current->mm);
414 pseudo_vma.vm_flags = (VM_HUGETLB | VM_MAYSHARE | VM_SHARED); 415 pseudo_vma.vm_flags = (VM_HUGETLB | VM_MAYSHARE | VM_SHARED);
415 pagevec_init(&pvec); 416 pagevec_init(&pvec);
416 next = start; 417 next = start;
@@ -595,6 +596,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
595 * as input to create an allocation policy. 596 * as input to create an allocation policy.
596 */ 597 */
597 memset(&pseudo_vma, 0, sizeof(struct vm_area_struct)); 598 memset(&pseudo_vma, 0, sizeof(struct vm_area_struct));
599 vma_init(&pseudo_vma, mm);
598 pseudo_vma.vm_flags = (VM_HUGETLB | VM_MAYSHARE | VM_SHARED); 600 pseudo_vma.vm_flags = (VM_HUGETLB | VM_MAYSHARE | VM_SHARED);
599 pseudo_vma.vm_file = file; 601 pseudo_vma.vm_file = file;
600 602
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h
index e6c0448ebcc7..31c865d1842e 100644
--- a/include/linux/delayacct.h
+++ b/include/linux/delayacct.h
@@ -124,7 +124,7 @@ static inline void delayacct_blkio_start(void)
124 124
125static inline void delayacct_blkio_end(struct task_struct *p) 125static inline void delayacct_blkio_end(struct task_struct *p)
126{ 126{
127 if (current->delays) 127 if (p->delays)
128 __delayacct_blkio_end(p); 128 __delayacct_blkio_end(p);
129 delayacct_clear_flag(DELAYACCT_PF_BLKIO); 129 delayacct_clear_flag(DELAYACCT_PF_BLKIO);
130} 130}
diff --git a/include/linux/eventfd.h b/include/linux/eventfd.h
index 7094718b653b..ffcc7724ca21 100644
--- a/include/linux/eventfd.h
+++ b/include/linux/eventfd.h
@@ -11,6 +11,7 @@
11 11
12#include <linux/fcntl.h> 12#include <linux/fcntl.h>
13#include <linux/wait.h> 13#include <linux/wait.h>
14#include <linux/err.h>
14 15
15/* 16/*
16 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining 17 * CAREFUL: Check include/uapi/asm-generic/fcntl.h when defining
diff --git a/include/linux/mm.h b/include/linux/mm.h
index d3a3842316b8..7ba6d356d18f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -452,6 +452,20 @@ struct vm_operations_struct {
452 unsigned long addr); 452 unsigned long addr);
453}; 453};
454 454
455static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm)
456{
457 static const struct vm_operations_struct dummy_vm_ops = {};
458
459 vma->vm_mm = mm;
460 vma->vm_ops = &dummy_vm_ops;
461 INIT_LIST_HEAD(&vma->anon_vma_chain);
462}
463
464static inline void vma_set_anonymous(struct vm_area_struct *vma)
465{
466 vma->vm_ops = NULL;
467}
468
455struct mmu_gather; 469struct mmu_gather;
456struct inode; 470struct inode;
457 471
diff --git a/ipc/sem.c b/ipc/sem.c
index 5af1943ad782..76e95e4f3aa2 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -2118,7 +2118,7 @@ static long do_semtimedop(int semid, struct sembuf __user *tsops,
2118 } 2118 }
2119 2119
2120 do { 2120 do {
2121 queue.status = -EINTR; 2121 WRITE_ONCE(queue.status, -EINTR);
2122 queue.sleeper = current; 2122 queue.sleeper = current;
2123 2123
2124 __set_current_state(TASK_INTERRUPTIBLE); 2124 __set_current_state(TASK_INTERRUPTIBLE);
diff --git a/kernel/fork.c b/kernel/fork.c
index a191c05e757d..1b27babc4c78 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -312,10 +312,8 @@ struct vm_area_struct *vm_area_alloc(struct mm_struct *mm)
312{ 312{
313 struct vm_area_struct *vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); 313 struct vm_area_struct *vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL);
314 314
315 if (vma) { 315 if (vma)
316 vma->vm_mm = mm; 316 vma_init(vma, mm);
317 INIT_LIST_HEAD(&vma->anon_vma_chain);
318 }
319 return vma; 317 return vma;
320} 318}
321 319
diff --git a/kernel/memremap.c b/kernel/memremap.c
index 5857267a4af5..38283363da06 100644
--- a/kernel/memremap.c
+++ b/kernel/memremap.c
@@ -176,10 +176,27 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
176 unsigned long pfn, pgoff, order; 176 unsigned long pfn, pgoff, order;
177 pgprot_t pgprot = PAGE_KERNEL; 177 pgprot_t pgprot = PAGE_KERNEL;
178 int error, nid, is_ram; 178 int error, nid, is_ram;
179 struct dev_pagemap *conflict_pgmap;
179 180
180 align_start = res->start & ~(SECTION_SIZE - 1); 181 align_start = res->start & ~(SECTION_SIZE - 1);
181 align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE) 182 align_size = ALIGN(res->start + resource_size(res), SECTION_SIZE)
182 - align_start; 183 - align_start;
184 align_end = align_start + align_size - 1;
185
186 conflict_pgmap = get_dev_pagemap(PHYS_PFN(align_start), NULL);
187 if (conflict_pgmap) {
188 dev_WARN(dev, "Conflicting mapping in same section\n");
189 put_dev_pagemap(conflict_pgmap);
190 return ERR_PTR(-ENOMEM);
191 }
192
193 conflict_pgmap = get_dev_pagemap(PHYS_PFN(align_end), NULL);
194 if (conflict_pgmap) {
195 dev_WARN(dev, "Conflicting mapping in same section\n");
196 put_dev_pagemap(conflict_pgmap);
197 return ERR_PTR(-ENOMEM);
198 }
199
183 is_ram = region_intersects(align_start, align_size, 200 is_ram = region_intersects(align_start, align_size,
184 IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE); 201 IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
185 202
@@ -199,7 +216,6 @@ void *devm_memremap_pages(struct device *dev, struct dev_pagemap *pgmap)
199 216
200 mutex_lock(&pgmap_lock); 217 mutex_lock(&pgmap_lock);
201 error = 0; 218 error = 0;
202 align_end = align_start + align_size - 1;
203 219
204 foreach_order_pgoff(res, order, pgoff) { 220 foreach_order_pgoff(res, order, pgoff) {
205 error = __radix_tree_insert(&pgmap_radix, 221 error = __radix_tree_insert(&pgmap_radix,
@@ -305,7 +321,7 @@ EXPORT_SYMBOL_GPL(get_dev_pagemap);
305 321
306#ifdef CONFIG_DEV_PAGEMAP_OPS 322#ifdef CONFIG_DEV_PAGEMAP_OPS
307DEFINE_STATIC_KEY_FALSE(devmap_managed_key); 323DEFINE_STATIC_KEY_FALSE(devmap_managed_key);
308EXPORT_SYMBOL_GPL(devmap_managed_key); 324EXPORT_SYMBOL(devmap_managed_key);
309static atomic_t devmap_enable; 325static atomic_t devmap_enable;
310 326
311/* 327/*
@@ -346,5 +362,5 @@ void __put_devmap_managed_page(struct page *page)
346 } else if (!count) 362 } else if (!count)
347 __put_page(page); 363 __put_page(page);
348} 364}
349EXPORT_SYMBOL_GPL(__put_devmap_managed_page); 365EXPORT_SYMBOL(__put_devmap_managed_page);
350#endif /* CONFIG_DEV_PAGEMAP_OPS */ 366#endif /* CONFIG_DEV_PAGEMAP_OPS */
diff --git a/lib/Kconfig.kasan b/lib/Kconfig.kasan
index c253c1b46c6b..befb127507c0 100644
--- a/lib/Kconfig.kasan
+++ b/lib/Kconfig.kasan
@@ -5,7 +5,7 @@ if HAVE_ARCH_KASAN
5 5
6config KASAN 6config KASAN
7 bool "KASan: runtime memory debugger" 7 bool "KASan: runtime memory debugger"
8 depends on SLUB || (SLAB && !DEBUG_SLAB) 8 depends on (SLUB && SYSFS) || (SLAB && !DEBUG_SLAB)
9 select SLUB_DEBUG if SLUB 9 select SLUB_DEBUG if SLUB
10 select CONSTRUCTORS 10 select CONSTRUCTORS
11 select STACKDEPOT 11 select STACKDEPOT
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 9ac49ef17b4e..01f1a14facc4 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2505,6 +2505,7 @@ void mpol_shared_policy_init(struct shared_policy *sp, struct mempolicy *mpol)
2505 2505
2506 /* Create pseudo-vma that contains just the policy */ 2506 /* Create pseudo-vma that contains just the policy */
2507 memset(&pvma, 0, sizeof(struct vm_area_struct)); 2507 memset(&pvma, 0, sizeof(struct vm_area_struct));
2508 vma_init(&pvma, NULL);
2508 pvma.vm_end = TASK_SIZE; /* policy covers entire file */ 2509 pvma.vm_end = TASK_SIZE; /* policy covers entire file */
2509 mpol_set_shared_policy(sp, &pvma, new); /* adds ref */ 2510 mpol_set_shared_policy(sp, &pvma, new); /* adds ref */
2510 2511
diff --git a/mm/mmap.c b/mm/mmap.c
index ff1944d8d458..17bbf4d3e24f 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1778,6 +1778,8 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
1778 error = shmem_zero_setup(vma); 1778 error = shmem_zero_setup(vma);
1779 if (error) 1779 if (error)
1780 goto free_vma; 1780 goto free_vma;
1781 } else {
1782 vma_set_anonymous(vma);
1781 } 1783 }
1782 1784
1783 vma_link(mm, vma, prev, rb_link, rb_parent); 1785 vma_link(mm, vma, prev, rb_link, rb_parent);
@@ -2983,6 +2985,7 @@ static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long fla
2983 return -ENOMEM; 2985 return -ENOMEM;
2984 } 2986 }
2985 2987
2988 vma_set_anonymous(vma);
2986 vma->vm_start = addr; 2989 vma->vm_start = addr;
2987 vma->vm_end = addr + len; 2990 vma->vm_end = addr + len;
2988 vma->vm_pgoff = pgoff; 2991 vma->vm_pgoff = pgoff;
diff --git a/mm/nommu.c b/mm/nommu.c
index 1d22fdbf7d7c..9fc9e43335b6 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1145,6 +1145,8 @@ static int do_mmap_private(struct vm_area_struct *vma,
1145 if (ret < len) 1145 if (ret < len)
1146 memset(base + ret, 0, len - ret); 1146 memset(base + ret, 0, len - ret);
1147 1147
1148 } else {
1149 vma_set_anonymous(vma);
1148 } 1150 }
1149 1151
1150 return 0; 1152 return 0;
diff --git a/mm/shmem.c b/mm/shmem.c
index 2cab84403055..41b9bbf24e16 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1421,6 +1421,7 @@ static void shmem_pseudo_vma_init(struct vm_area_struct *vma,
1421{ 1421{
1422 /* Create a pseudo vma that just contains the policy */ 1422 /* Create a pseudo vma that just contains the policy */
1423 memset(vma, 0, sizeof(*vma)); 1423 memset(vma, 0, sizeof(*vma));
1424 vma_init(vma, NULL);
1424 /* Bias interleave by inode number to distribute better across nodes */ 1425 /* Bias interleave by inode number to distribute better across nodes */
1425 vma->vm_pgoff = index + info->vfs_inode.i_ino; 1426 vma->vm_pgoff = index + info->vfs_inode.i_ino;
1426 vma->vm_policy = mpol_shared_policy_lookup(&info->policy, index); 1427 vma->vm_policy = mpol_shared_policy_lookup(&info->policy, index);
diff --git a/mm/zswap.c b/mm/zswap.c
index 7d34e69507e3..cd91fd9d96b8 100644
--- a/mm/zswap.c
+++ b/mm/zswap.c
@@ -1026,6 +1026,15 @@ static int zswap_frontswap_store(unsigned type, pgoff_t offset,
1026 ret = -ENOMEM; 1026 ret = -ENOMEM;
1027 goto reject; 1027 goto reject;
1028 } 1028 }
1029
1030 /* A second zswap_is_full() check after
1031 * zswap_shrink() to make sure it's now
1032 * under the max_pool_percent
1033 */
1034 if (zswap_is_full()) {
1035 ret = -ENOMEM;
1036 goto reject;
1037 }
1029 } 1038 }
1030 1039
1031 /* allocate entry */ 1040 /* allocate entry */