Skip to content

Commit

Permalink
powerpc/mm: Drop VM_BUG_ON in get_region_id()
Browse files Browse the repository at this point in the history
We call get_region_id() without validating the ea value. That means
with a wrong ea value we hit the BUG as below.

  kernel BUG at arch/powerpc/include/asm/book3s/64/hash.h:129!
  Oops: Exception in kernel mode, sig: 5 [#1]
  LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
  CPU: 0 PID: 3937 Comm: access_tests Not tainted 5.1.0
  ....
  NIP [c00000000007ba20] do_slb_fault+0x70/0x320
  LR [c00000000000896c] data_access_slb_common+0x15c/0x1a0

Fix this by removing the VM_BUG_ON. All callers make sure the returned
region id is valid and error out otherwise.

Fixes: 0034d39 ("powerpc/mm/hash64: Map all the kernel regions in the same 0xc range")
Reported-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
  • Loading branch information
kvaneesh authored and mpe committed May 16, 2019
1 parent 7338874 commit 6457f42
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions arch/powerpc/include/asm/book3s/64/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ static inline int get_region_id(unsigned long ea)
if (ea < H_KERN_VIRT_START)
return LINEAR_MAP_REGION_ID;

VM_BUG_ON(id != 0xc);
BUILD_BUG_ON(NON_LINEAR_REGION_ID(H_VMALLOC_START) != 2);

region_id = NON_LINEAR_REGION_ID(ea);
VM_BUG_ON(region_id > VMEMMAP_REGION_ID);
return region_id;
}

Expand Down

0 comments on commit 6457f42

Please sign in to comment.