linux/arch
Ryan Grimm 3bc64c1b58 cxl: Fix device_node reference counting
commit 6f963ec2d6 upstream.

When unbinding and rebinding the driver on a system with a card in PHB0, this
error condition is reached after a few attempts:

ERROR: Bad of_node_put() on /pciex@3fffe40000000
CPU: 0 PID: 3040 Comm: bash Not tainted 3.18.0-rc3-12545-g3627ffe #152
Call Trace:
[c000000721acb5c0] [c00000000086ef94] .dump_stack+0x84/0xb0 (unreliable)
[c000000721acb640] [c00000000073a0a8] .of_node_release+0xd8/0xe0
[c000000721acb6d0] [c00000000044bc44] .kobject_release+0x74/0xe0
[c000000721acb760] [c0000000007394fc] .of_node_put+0x1c/0x30
[c000000721acb7d0] [c000000000545cd8] .cxl_probe+0x1a98/0x1d50
[c000000721acb900] [c0000000004845a0] .local_pci_probe+0x40/0xc0
[c000000721acb980] [c000000000484998] .pci_device_probe+0x128/0x170
[c000000721acba30] [c00000000052400c] .driver_probe_device+0xac/0x2a0
[c000000721acbad0] [c000000000522468] .bind_store+0x108/0x160
[c000000721acbb70] [c000000000521448] .drv_attr_store+0x38/0x60
[c000000721acbbe0] [c000000000293840] .sysfs_kf_write+0x60/0xa0
[c000000721acbc50] [c000000000292500] .kernfs_fop_write+0x140/0x1d0
[c000000721acbcf0] [c000000000208648] .vfs_write+0xd8/0x260
[c000000721acbd90] [c000000000208b18] .SyS_write+0x58/0x100
[c000000721acbe30] [c000000000009258] syscall_exit+0x0/0x98

We are missing a call to of_node_get(). pnv_pci_to_phb_node() should
call of_node_get() otherwise np's reference count isn't incremented and
it might go away. Rename pnv_pci_to_phb_node() to pnv_pci_get_phb_node()
so it's clear it calls of_node_get().

Signed-off-by: Ryan Grimm <grimm@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>
History 2015-03-23 21:02:54 -04:00
..
alpha vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
arc ARC: Fix KSTK_ESP() 2015-03-14 15:37:27 -04:00
arm hx4700: regulator: declare full constraints 2015-03-06 14:53:03 -08:00
arm64 arm64: compat Fix siginfo_t -> compat_siginfo_t conversion on big endian 2015-03-06 14:53:03 -08:00
avr32 vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
blackfin Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2014-10-15 07:48:18 +02:00
c6x irq_work: Introduce arch_irq_work_has_interrupt() 2014-09-13 18:38:07 +02:00
cris vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
frv vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
hexagon Merge branch 'locking-arch-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2014-10-13 15:48:00 +02:00
ia64 vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
m32r vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
m68k vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
metag metag: Fix KSTK_EIP() and KSTK_ESP() macros 2015-03-06 14:53:04 -08:00
microblaze vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
mips KVM: MIPS: Fix trace event to save PC directly 2015-03-14 15:37:22 -04:00
mn10300 vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
openrisc vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
parisc vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
powerpc cxl: Fix device_node reference counting 2015-03-23 21:02:54 -04:00
s390 KVM: s390: avoid memory leaks if __inject_vm() fails 2015-03-06 14:53:03 -08:00
score vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
sh vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
sparc vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
tile vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
um vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
unicore32 nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2014-10-09 22:26:04 -04:00
x86 KVM: emulate: fix CMPXCHG8B on 32-bit hosts 2015-03-14 15:37:22 -04:00
xtensa vm: add VM_FAULT_SIGSEGV handling support 2015-02-05 22:36:01 -08:00
.gitignore arch: Ignore arch/i386 and arch/x86_64 2008-01-19 21:29:39 -08:00
Kconfig seccomp: Document two-phase seccomp and arch-provided seccomp_data 2014-09-03 14:58:17 -07:00