powerpc/mm: Prevent unlikely crash in copro_calculate_slb()
authorFrederic Barrat <fbarrat@linux.vnet.ibm.com>
Fri, 17 Jun 2016 16:53:28 +0000 (18:53 +0200)
committerSasha Levin <alexander.levin@verizon.com>
Thu, 24 Nov 2016 00:58:29 +0000 (19:58 -0500)
commit3c9c01324032e33d888f699bb694f7b4abcfb7d0
tree0b98b318e8608cd75df104c8690371b449567635
parentc1f5e5f89b9916333efc1c9bcf9c648c192e072b
powerpc/mm: Prevent unlikely crash in copro_calculate_slb()

[ Upstream commit d2cf909cda5f8c5609cb7ed6cda816c3e15528c7 ]

If a cxl adapter faults on an invalid address for a kernel context, we
may enter copro_calculate_slb() with a NULL mm pointer (kernel
context) and an effective address which looks like a user
address. Which will cause a crash when dereferencing mm. It is clearly
an AFU bug, but there's no reason to crash either. So return an error,
so that cxl can ack the interrupt with an address error.

Fixes: 73d16a6e0e51 ("powerpc/cell: Move data segment faulting code out of cell platform")
Cc: stable@vger.kernel.org # v3.18+
Signed-off-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Ian Munsie <imunsie@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
arch/powerpc/mm/copro_fault.c