Skip to content

Commit 86a78a8

Browse files
committed
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
2 parents bcd1739 + 672eaf3 commit 86a78a8

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

arch/powerpc/include/asm/book3s/64/hash.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
#define VMALLOC_REGION_ID NON_LINEAR_REGION_ID(H_VMALLOC_START)
9494
#define IO_REGION_ID NON_LINEAR_REGION_ID(H_KERN_IO_START)
9595
#define VMEMMAP_REGION_ID NON_LINEAR_REGION_ID(H_VMEMMAP_START)
96+
#define INVALID_REGION_ID (VMEMMAP_REGION_ID + 1)
9697

9798
/*
9899
* 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)
119120
if (id == 0)
120121
return USER_REGION_ID;
121122

123+
if (id != (PAGE_OFFSET >> 60))
124+
return INVALID_REGION_ID;
125+
122126
if (ea < H_KERN_VIRT_START)
123127
return LINEAR_MAP_REGION_ID;
124128

125-
VM_BUG_ON(id != 0xc);
126129
BUILD_BUG_ON(NON_LINEAR_REGION_ID(H_VMALLOC_START) != 2);
127130

128131
region_id = NON_LINEAR_REGION_ID(ea);
129-
VM_BUG_ON(region_id > VMEMMAP_REGION_ID);
130132
return region_id;
131133
}
132134

arch/powerpc/kernel/cacheinfo.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -767,7 +767,6 @@ static void cacheinfo_create_index_dir(struct cache *cache, int index,
767767
cache_dir->kobj, "index%d", index);
768768
if (rc) {
769769
kobject_put(&index_dir->kobj);
770-
kfree(index_dir);
771770
return;
772771
}
773772

arch/powerpc/mm/book3s32/hash_low.S

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ _GLOBAL(flush_hash_pages)
539539
#ifdef CONFIG_SMP
540540
lis r9, (mmu_hash_lock - PAGE_OFFSET)@ha
541541
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)
543544
oris r8,r8,9
544545
10: lwarx r0,0,r9
545546
cmpi 0,r0,0

arch/powerpc/mm/hugetlbpage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ static int __init add_huge_page_size(unsigned long long size)
556556
if (size <= PAGE_SIZE || !is_power_of_2(size))
557557
return -EINVAL;
558558

559-
mmu_psize = check_and_get_huge_psize(size);
559+
mmu_psize = check_and_get_huge_psize(shift);
560560
if (mmu_psize < 0)
561561
return -EINVAL;
562562

0 commit comments

Comments
 (0)