linux_dsm_epyc7002/arch/powerpc/platforms/pseries
Tyrel Datwyler 087ff6a5ae powerpc/pseries: Fix "OF: ERROR: Bad of_node_put() on /cpus" during DLPAR
Commit 215ee763f8 ("powerpc: pseries: remove dlpar_attach_node
dependency on full path") reworked dlpar_attach_node() to no longer
look up the parent node "/cpus", but instead to have the parent node
passed by the caller in the function parameter list.

As a result dlpar_attach_node() is no longer responsible for freeing
the reference to the parent node. However, commit 215ee763f8 failed
to remove the of_node_put(parent) call in dlpar_attach_node(), or to
take into account that the reference to the parent in the caller
dlpar_cpu_add() needs to be held until after dlpar_attach_node()
returns.

As a result doing repeated cpu add/remove dlpar operations will
eventually result in the following error:

  OF: ERROR: Bad of_node_put() on /cpus
  CPU: 0 PID: 10896 Comm: drmgr Not tainted 4.13.0-autotest #1
  Call Trace:
   dump_stack+0x15c/0x1f8 (unreliable)
   of_node_release+0x1a4/0x1c0
   kobject_put+0x1a8/0x310
   kobject_del+0xbc/0xf0
   __of_detach_node_sysfs+0x144/0x210
   of_detach_node+0xf0/0x180
   dlpar_detach_node+0xc4/0x120
   dlpar_cpu_remove+0x280/0x560
   dlpar_cpu_release+0xbc/0x1b0
   arch_cpu_release+0x6c/0xb0
   cpu_release_store+0xa0/0x100
   dev_attr_store+0x68/0xa0
   sysfs_kf_write+0xa8/0xf0
   kernfs_fop_write+0x2cc/0x400
   __vfs_write+0x5c/0x340
   vfs_write+0x1a8/0x3d0
   SyS_write+0xa8/0x1a0
   system_call+0x58/0x6c

Fix the issue by removing the of_node_put(parent) call from
dlpar_attach_node(), and ensuring that the reference to the parent
node is properly held and released by the caller dlpar_cpu_add().

Fixes: 215ee763f8 ("powerpc: pseries: remove dlpar_attach_node dependency on full path")
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Reported-by: Abdul Haleem <abdhalee@linux.vnet.ibm.com>
[mpe: Add a comment in the code and frob the change log slightly]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2017-09-21 19:30:53 +10:00
..
cmm.c powerpc/pseries: Fix typo in parameter description 2017-02-10 15:20:07 +11:00
dlpar.c powerpc/pseries: Fix "OF: ERROR: Bad of_node_put() on /cpus" during DLPAR 2017-09-21 19:30:53 +10:00
dtl.c powerpc: Create asm/debugfs.h and move powerpc_debugfs_root there 2017-04-11 07:46:03 +10:00
eeh_pseries.c powerpc/eeh: Remove unnecessary config_addr from eeh_dev 2017-08-31 14:26:09 +10:00
event_sources.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
firmware.c Merge branch 'topic/ppc-kvm' into next 2017-02-14 17:18:29 +11:00
hotplug-cpu.c powerpc/pseries: Fix "OF: ERROR: Bad of_node_put() on /cpus" during DLPAR 2017-09-21 19:30:53 +10:00
hotplug-memory.c powerpc/pseries: Don't attempt to acquire drc during memory hot add for assigned lmbs 2017-08-31 20:02:23 +10:00
hvCall_inst.c powerpc/pseries: Move struct hcall_stats to hvCall_inst.c 2017-03-20 19:02:49 +11:00
hvCall.S powerpc/asm: Convert .llong directives to .8byte 2017-08-31 14:26:47 +10:00
hvconsole.c powerpc: Fix misspellings in comments. 2016-03-01 19:27:20 +11:00
hvcserver.c powerpc/pseries/hvcserver: don't memset pi_buff if it is null 2015-10-09 08:03:03 +11:00
ibmebus.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
io_event_irq.c powerpc: Various typo fixes 2016-06-14 13:58:26 +10:00
iommu.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
Kconfig powerpc/xive: guest exploitation of the XIVE interrupt controller 2017-09-02 21:02:35 +10:00
kexec.c powerpc/xive: guest exploitation of the XIVE interrupt controller 2017-09-02 21:02:35 +10:00
lpar.c powerpc/pseries: Fix passing of pp0 in updatepp() and updateboltedpp() 2017-07-03 23:12:19 +10:00
lparcfg.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
Makefile powerpc: Change places using CONFIG_KEXEC to use CONFIG_KEXEC_CORE instead. 2016-11-30 23:15:11 +11:00
mobility.c powerpc: pseries: remove dlpar_attach_node dependency on full path 2017-08-23 22:27:04 +10:00
msi.c powerpc/pci: Remove OF node back pointer from pci_dn 2017-08-31 14:26:12 +10:00
nvram.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
of_helpers.c powerpc/pseries: Correct string length in pseries_of_derive_parent() 2015-10-28 12:08:18 +09:00
of_helpers.h powerpc/pseries: extract of_helpers module 2015-10-05 21:11:24 +11:00
offline_states.h powerpc/smp: soft-replugged CPUs must go back to start_secondary 2011-04-01 15:37:09 +11:00
pci_dlpar.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00
pci.c powerpc/pseries: use pci_host_bridge.release_fn() to kfree(phb) 2016-08-22 11:09:33 +10:00
power.c powerpc/sparse: Include headers containing prototypes 2016-06-16 22:40:19 +10:00
pseries_energy.c powerpc/pseries: Don't print failure message in energy driver 2017-08-10 22:30:29 +10:00
pseries.h powerpc: pseries: remove dlpar_attach_node dependency on full path 2017-08-23 22:27:04 +10:00
ras.c powerpc/pseries/le: Work around a firmware quirk 2017-08-31 14:26:02 +10:00
reconfig.c Merge branch 'fixes' into next 2017-08-23 22:20:10 +10:00
rng.c powerpc: Use hardware RNG for arch_get_random_seed_* not arch_get_random_* 2015-07-23 19:52:03 +10:00
scanlog.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
setup.c powerpc/xive: guest exploitation of the XIVE interrupt controller 2017-09-02 21:02:35 +10:00
smp.c powerpc/xive: guest exploitation of the XIVE interrupt controller 2017-09-02 21:02:35 +10:00
suspend.c mm: treewide: remove GFP_TEMPORARY allocation flag 2017-09-13 18:53:16 -07:00
vio.c powerpc: Convert to using %pOF instead of full_name 2017-08-23 22:27:04 +10:00