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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 28 Oct 2016 07:01:35 +0000 (03:01 -0400)
commitc346241e752ab9131689bce55d250ab2493ef952
tree81900bd44c381d1d32a3070768a2a6606ab5d628
parente382e130d45a9f95c8da77bc8bca1464ae9c6cae
powerpc/mm: Prevent unlikely crash in copro_calculate_slb()

commit d2cf909cda5f8c5609cb7ed6cda816c3e15528c7 upstream.

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")
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/mm/copro_fault.c