linux/drivers/misc/cxl
Daniel Axtens 4a0c377cda cxl: Check if afu is not null in cxl_slbia
commit 2c069a118f upstream.

The pointer to an AFU in the adapter's list of AFUs can be null
if we're in the process of removing AFUs. The afu_list_lock
doesn't guard against this.

Say we have 2 slices, and we're in the process of removing cxl.
 - We remove the AFUs in order (see cxl_remove). In cxl_remove_afu
   for AFU 0, we take the lock, set adapter->afu[0] = NULL, and
   release the lock.
 - Then we get an slbia. In cxl_slbia we take the lock, and set
   afu = adapter->afu[0], which is NULL.
 - Therefore our attempt to check afu->enabled will blow up.

Therefore, check if afu is a null pointer before dereferencing it.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Acked-by: Michael Neuling <mikey@neuling.org>
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>
History 2015-08-10 12:21:50 -07:00
..
base.c cxl: Add base builtin support 2014-10-08 20:15:56 +11:00
context.c cxl: Fix off by one error allowing subsequent mmap page to be accessed 2015-08-10 12:21:50 -07:00
cxl.h cxl: Export optional AFU configuration record in sysfs 2015-02-06 11:16:56 +11:00
debugfs.c cxl: Driver code for powernv PCIe based cards for userspace access 2014-10-08 20:15:57 +11:00
fault.c cxl: Add tracepoints 2015-01-22 17:31:51 +11:00
file.c powerpc updates for 3.20 2015-02-11 18:15:38 -08:00
irq.c cxl: Add missing return statement after handling AFU errror 2015-02-06 11:17:27 +11:00
Kconfig cxl: Add driver to Kbuild and Makefiles 2014-10-08 20:15:58 +11:00
main.c cxl: Check if afu is not null in cxl_slbia 2015-08-10 12:21:50 -07:00
Makefile cxl: Add tracepoints 2015-01-22 17:31:51 +11:00
native.c cxl: Add tracepoints 2015-01-22 17:31:51 +11:00
pci.c cxl: Fail AFU initialisation if an invalid configuration record is found 2015-02-06 11:16:58 +11:00
sysfs.c cxl: Export optional AFU configuration record in sysfs 2015-02-06 11:16:56 +11:00
trace.c cxl: Add tracepoints 2015-01-22 17:31:51 +11:00
trace.h cxl: Add tracepoints 2015-01-22 17:31:51 +11:00