android_kernel_oneplus_msm8998/arch/powerpc
Radu Rendec ee2bc807cb powerpc/msi: Fix NULL pointer access in teardown code
commit 78e7b15e17ac175e7eed9e21c6f92d03d3b0a6fa upstream.

The arch_teardown_msi_irqs() function assumes that controller ops
pointers were already checked in arch_setup_msi_irqs(), but this
assumption is wrong: arch_teardown_msi_irqs() can be called even when
arch_setup_msi_irqs() returns an error (-ENOSYS).

This can happen in the following scenario:
  - msi_capability_init() calls pci_msi_setup_msi_irqs()
  - pci_msi_setup_msi_irqs() returns -ENOSYS
  - msi_capability_init() notices the error and calls free_msi_irqs()
  - free_msi_irqs() calls pci_msi_teardown_msi_irqs()

This is easier to see when CONFIG_PCI_MSI_IRQ_DOMAIN is not set and
pci_msi_setup_msi_irqs() and pci_msi_teardown_msi_irqs() are just
aliases to arch_setup_msi_irqs() and arch_teardown_msi_irqs().

The call to free_msi_irqs() upon pci_msi_setup_msi_irqs() failure
seems legit, as it does additional cleanup; e.g.
list_del(&entry->list) and kfree(entry) inside free_msi_irqs() do
happen (MSI descriptors are allocated before pci_msi_setup_msi_irqs()
is called and need to be cleaned up if that fails).

Fixes: 6b2fd7efeb ("PCI/MSI/PPC: Remove arch_msi_check_device()")
Cc: stable@vger.kernel.org # v3.18+
Signed-off-by: Radu Rendec <radu.rendec@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-21 14:09:51 +01:00
..
boot powerpc/boot: Fix random libfdt related build errors 2018-12-21 14:09:49 +01:00
configs powerpc updates for 4.4 2015-11-05 23:38:43 -08:00
crypto crypto: powerpc/md5 - use md5 IV MD5_HX instead of their raw value 2015-05-18 12:20:20 +08:00
include powerpc/msi: Fix compile error on mpc83xx 2018-11-21 09:27:36 +01:00
kernel powerpc/msi: Fix NULL pointer access in teardown code 2018-12-21 14:09:51 +01:00
kvm KVM: PPC: Move and undef TRACE_INCLUDE_PATH/FILE 2018-12-01 09:46:34 +01:00
lib powerpc/lib: Fix off-by-one in alternate feature patching 2018-04-24 09:32:11 +02:00
math-emu
mm powerpc/numa: Suppress "VPHN is not supported" messages 2018-12-01 09:46:35 +01:00
net powerpc/bpf/jit: Fix 32-bit JIT for seccomp_data access 2018-05-30 07:49:00 +02:00
oprofile powerpc: Remove mtmsrd(), use existing mtmsr() 2015-07-13 15:47:28 +10:00
perf powerpc/perf: Fix kernel address leak via sampling registers 2018-05-30 07:49:10 +02:00
platforms powerpc/powernv/ioda2: Reduce upper limit for DMA window size 2018-10-10 08:52:05 +02:00
sysdev powerpc: Fix size calculation using resource_size() 2018-09-15 09:40:39 +02:00
xmon powerpc/xmon: Add some more elements to the existing PACA dump list 2015-10-15 20:32:02 +11:00
Kconfig powerpc/64s: Wire up cpu_show_meltdown() 2018-02-16 20:09:36 +01:00
Kconfig.debug powerpc: Make STRICT_MM_TYPECHECKS a config option 2015-05-11 19:53:59 +10:00
Makefile powerpc/cell: Drop CONFIG_TUNE_CELL in favour of CONFIG_CELL_CPU 2015-10-19 19:51:18 +11:00
relocs_check.sh powerpc: Convert relocs_check to a shell script using grep 2015-03-23 14:47:39 +11:00