diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-19 13:10:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-19 13:10:15 -0400 |
commit | 86a78a8b8d0414455c2174852968ce54205add82 (patch) | |
tree | 333fd5f6bd0a20855ec6cda3bfb2646a960fe226 | |
parent | bcd1739788e2ea111d0d2efe1ed6633d9f6a20da (diff) | |
parent | 672eaf37db9f99fd794eed2c68a8b3b05d484081 (diff) |
Merge tag 'powerpc-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman:
"One fix going back to stable, for a bug on 32-bit introduced when we
added support for THREAD_INFO_IN_TASK.
A fix for a typo in a recent rework of our hugetlb code that leads to
crashes on 64-bit when using hugetlbfs with a 4K PAGE_SIZE.
Two fixes for our recent rework of the address layout on 64-bit hash
CPUs, both only triggered when userspace tries to access addresses
outside the user or kernel address ranges.
Finally a fix for a recently introduced double free in an error path
in our cacheinfo code.
Thanks to: Aneesh Kumar K.V, Christophe Leroy, Sachin Sant, Tobin C.
Harding"
* tag 'powerpc-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
powerpc/cacheinfo: Remove double free
powerpc/mm/hash: Fix get_region_id() for invalid addresses
powerpc/mm: Drop VM_BUG_ON in get_region_id()
powerpc/mm: Fix crashes with hugepages & 4K pages
powerpc/32s: fix flush_hash_pages() on SMP
-rw-r--r-- | arch/powerpc/include/asm/book3s/64/hash.h | 6 | ||||
-rw-r--r-- | arch/powerpc/kernel/cacheinfo.c | 1 | ||||
-rw-r--r-- | arch/powerpc/mm/book3s32/hash_low.S | 3 | ||||
-rw-r--r-- | arch/powerpc/mm/hugetlbpage.c | 2 |
4 files changed, 7 insertions, 5 deletions
diff --git a/arch/powerpc/include/asm/book3s/64/hash.h b/arch/powerpc/include/asm/book3s/64/hash.h index 1d1183048cfd..2781ebf6add4 100644 --- a/arch/powerpc/include/asm/book3s/64/hash.h +++ b/arch/powerpc/include/asm/book3s/64/hash.h | |||
@@ -93,6 +93,7 @@ | |||
93 | #define VMALLOC_REGION_ID NON_LINEAR_REGION_ID(H_VMALLOC_START) | 93 | #define VMALLOC_REGION_ID NON_LINEAR_REGION_ID(H_VMALLOC_START) |
94 | #define IO_REGION_ID NON_LINEAR_REGION_ID(H_KERN_IO_START) | 94 | #define IO_REGION_ID NON_LINEAR_REGION_ID(H_KERN_IO_START) |
95 | #define VMEMMAP_REGION_ID NON_LINEAR_REGION_ID(H_VMEMMAP_START) | 95 | #define VMEMMAP_REGION_ID NON_LINEAR_REGION_ID(H_VMEMMAP_START) |
96 | #define INVALID_REGION_ID (VMEMMAP_REGION_ID + 1) | ||
96 | 97 | ||
97 | /* | 98 | /* |
98 | * Defines the address of the vmemap area, in its own region on | 99 | * Defines the address of the vmemap area, in its own region on |
@@ -119,14 +120,15 @@ static inline int get_region_id(unsigned long ea) | |||
119 | if (id == 0) | 120 | if (id == 0) |
120 | return USER_REGION_ID; | 121 | return USER_REGION_ID; |
121 | 122 | ||
123 | if (id != (PAGE_OFFSET >> 60)) | ||
124 | return INVALID_REGION_ID; | ||
125 | |||
122 | if (ea < H_KERN_VIRT_START) | 126 | if (ea < H_KERN_VIRT_START) |
123 | return LINEAR_MAP_REGION_ID; | 127 | return LINEAR_MAP_REGION_ID; |
124 | 128 | ||
125 | VM_BUG_ON(id != 0xc); | ||
126 | BUILD_BUG_ON(NON_LINEAR_REGION_ID(H_VMALLOC_START) != 2); | 129 | BUILD_BUG_ON(NON_LINEAR_REGION_ID(H_VMALLOC_START) != 2); |
127 | 130 | ||
128 | region_id = NON_LINEAR_REGION_ID(ea); | 131 | region_id = NON_LINEAR_REGION_ID(ea); |
129 | VM_BUG_ON(region_id > VMEMMAP_REGION_ID); | ||
130 | return region_id; | 132 | return region_id; |
131 | } | 133 | } |
132 | 134 | ||
diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c index f2ed3ef4b129..862e2890bd3d 100644 --- a/arch/powerpc/kernel/cacheinfo.c +++ b/arch/powerpc/kernel/cacheinfo.c | |||
@@ -767,7 +767,6 @@ static void cacheinfo_create_index_dir(struct cache *cache, int index, | |||
767 | cache_dir->kobj, "index%d", index); | 767 | cache_dir->kobj, "index%d", index); |
768 | if (rc) { | 768 | if (rc) { |
769 | kobject_put(&index_dir->kobj); | 769 | kobject_put(&index_dir->kobj); |
770 | kfree(index_dir); | ||
771 | return; | 770 | return; |
772 | } | 771 | } |
773 | 772 | ||
diff --git a/arch/powerpc/mm/book3s32/hash_low.S b/arch/powerpc/mm/book3s32/hash_low.S index e27792d0b744..8366c2abeafc 100644 --- a/arch/powerpc/mm/book3s32/hash_low.S +++ b/arch/powerpc/mm/book3s32/hash_low.S | |||
@@ -539,7 +539,8 @@ _GLOBAL(flush_hash_pages) | |||
539 | #ifdef CONFIG_SMP | 539 | #ifdef CONFIG_SMP |
540 | lis r9, (mmu_hash_lock - PAGE_OFFSET)@ha | 540 | lis r9, (mmu_hash_lock - PAGE_OFFSET)@ha |
541 | addi r9, r9, (mmu_hash_lock - PAGE_OFFSET)@l | 541 | addi r9, r9, (mmu_hash_lock - PAGE_OFFSET)@l |
542 | lwz r8,TASK_CPU(r2) | 542 | tophys (r8, r2) |
543 | lwz r8, TASK_CPU(r8) | ||
543 | oris r8,r8,9 | 544 | oris r8,r8,9 |
544 | 10: lwarx r0,0,r9 | 545 | 10: lwarx r0,0,r9 |
545 | cmpi 0,r0,0 | 546 | cmpi 0,r0,0 |
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index c5c9ff2d7afc..b5d92dc32844 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c | |||
@@ -556,7 +556,7 @@ static int __init add_huge_page_size(unsigned long long size) | |||
556 | if (size <= PAGE_SIZE || !is_power_of_2(size)) | 556 | if (size <= PAGE_SIZE || !is_power_of_2(size)) |
557 | return -EINVAL; | 557 | return -EINVAL; |
558 | 558 | ||
559 | mmu_psize = check_and_get_huge_psize(size); | 559 | mmu_psize = check_and_get_huge_psize(shift); |
560 | if (mmu_psize < 0) | 560 | if (mmu_psize < 0) |
561 | return -EINVAL; | 561 | return -EINVAL; |
562 | 562 | ||