powerpc/64s/hash: Fix 128TB-512TB virtual address boundary case allocation
authorNicholas Piggin <npiggin@gmail.com>
Thu, 9 Nov 2017 17:27:36 +0000 (04:27 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Nov 2017 08:40:57 +0000 (08:40 +0000)
commit2279e9c895778cc8942b82e6e9fa153d5024acc2
tree9ff308d58c83df69daf477edb34253337772c212
parent45567ab5983900c5363019c5465b1dc46fa0218d
powerpc/64s/hash: Fix 128TB-512TB virtual address boundary case allocation

commit 6a72dc038b615229a1b285829d6c8378d15c2347 upstream.

When allocating VA space with a hint that crosses 128TB, the SLB
addr_limit variable is not expanded if addr is not > 128TB, but the
slice allocation looks at task_size, which is 512TB. This results in
slice_check_fit() incorrectly succeeding because the slice_count
truncates off bit 128 of the requested mask, so the comparison to the
available mask succeeds.

Fix this by using mm->context.addr_limit instead of mm->task_size for
testing allocation limits. This causes such allocations to fail.

Fixes: f4ea6dcb08ea ("powerpc/mm: Enable mappings above 128TB")
Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/mm/slice.c