linux_dsm_epyc7002/arch/powerpc/platforms
Greg Kurz 02c5f53949 powerpc/powernv/npu: Fix reference leak
Since 902bdc5745, get_pci_dev() calls pci_get_domain_bus_and_slot(). This
has the effect of incrementing the reference count of the PCI device, as
explained in drivers/pci/search.c:

 * Given a PCI domain, bus, and slot/function number, the desired PCI
 * device is located in the list of PCI devices. If the device is
 * found, its reference count is increased and this function returns a
 * pointer to its data structure.  The caller must decrement the
 * reference count by calling pci_dev_put().  If no device is found,
 * %NULL is returned.

Nothing was done to call pci_dev_put() and the reference count of GPU and
NPU PCI devices rockets up.

A natural way to fix this would be to teach the callers about the change,
so that they call pci_dev_put() when done with the pointer. This turns
out to be quite intrusive, as it affects many paths in npu-dma.c,
pci-ioda.c and vfio_pci_nvlink2.c. Also, the issue appeared in 4.16 and
some affected code got moved around since then: it would be problematic
to backport the fix to stable releases.

All that code never cared for reference counting anyway. Call pci_dev_put()
from get_pci_dev() to revert to the previous behavior.

Fixes: 902bdc5745 ("powerpc/powernv/idoa: Remove unnecessary pcidev from pci_dn")
Cc: stable@vger.kernel.org # v4.16
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2019-06-02 19:39:36 +10:00
..
4xx treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
8xx powerpc/8xx: Fix possible device node reference leak 2019-04-20 22:02:35 +10:00
40x treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
44x powerpc/44x: Force PCI on for CURRITUCK 2019-02-22 00:10:15 +11:00
52xx *: convert stream-like files from nonseekable_open -> stream_open 2019-05-06 17:46:41 +03:00
82xx powerpc/kconfig: remove CONFIG_6xx 2018-11-26 22:33:37 +11:00
83xx powerpc/83xx: Add missing of_node_put() after of_device_is_available() 2019-04-20 22:02:27 +10:00
85xx powerpc/dma: trim the fat from <asm/dma-mapping.h> 2019-02-18 22:41:04 +11:00
86xx powerpc/dma: use the generic direct mapping bypass 2019-02-18 22:41:04 +11:00
512x treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 40 2019-05-24 17:27:12 +02:00
amigaone treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
cell treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 118 2019-05-24 17:39:02 +02:00
chrp treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
embedded6xx powerpc/embedded6xx: Remove unused functions holly_power_off and holly_halt 2019-04-20 22:02:12 +10:00
maple treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pasemi treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
powermac treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
powernv powerpc/powernv/npu: Fix reference leak 2019-06-02 19:39:36 +10:00
ps3 treewide: add checks for the return value of memblock_alloc*() 2019-03-12 10:04:02 -07:00
pseries powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property() 2019-06-02 19:39:35 +10:00
fsl_uli1575.c
Kconfig Kconfig file consolidation for v4.21 2018-12-29 13:40:29 -08:00
Kconfig.cputype hugetlb: allow to free gigantic pages regardless of the configuration 2019-05-14 09:47:47 -07:00
Makefile powerpc: Add -Werror at arch/powerpc level 2018-10-19 00:56:17 +11:00