linux/arch/powerpc/platforms/pseries
Gavin Shan 1e38b71401 powerpc/eeh: Fix crash on converting OF node to edev
The kernel crash was reported by Alexy. He was testing some feature
with private kernel, in which Alexy added some code in pci_pm_reset()
to read the CSR after writting it. The bug could be reproduced on
Fiber Channel card (Fibre Channel: Emulex Corporation Saturn-X:
LightPulse Fibre Channel Host Adapter (rev 03)) by the following
commands.

	# echo 1 > /sys/devices/pci0004:01/0004:01:00.0/reset
	# rmmod lpfc
	# modprobe lpfc

The history behind the test case is that those additional config
space reading operations in pci_pm_reset() would cause EEH error,
but we didn't detect EEH error until "modprobe lpfc". For the case,
all the PCI devices on PCI bus (0004:01) were removed and added after
PE reset. Then the EEH devices would be figured out again based on
the OF nodes. Unfortunately, there were some child OF nodes under
PCI device (0004:01:00.0), but they didn't have attached PCI_DN since
they're invisible from PCI domain. However, we were still trying to
convert OF node to EEH device without checking on the attached PCI_DN.
Eventually, it caused the kernel crash as follows:

Unable to handle kernel paging request for data at address 0x00000030
Faulting instruction address: 0xc00000000004d888
cpu 0x0: Vector: 300 (Data Access) at [c000000fc797b950]
    pc: c00000000004d888: .eeh_add_device_tree_early+0x78/0x140
    lr: c00000000004d880: .eeh_add_device_tree_early+0x70/0x140
    sp: c000000fc797bbd0
   msr: 8000000000009032
   dar: 30
 dsisr: 40000000
  current = 0xc000000fc78d9f70
  paca    = 0xc00000000edb0000   softe: 0        irq_happened: 0x00
    pid   = 2951, comm = eehd
enter ? for help
[c000000fc797bc50] c00000000004d848 .eeh_add_device_tree_early+0x38/0x140
[c000000fc797bcd0] c00000000004d848 .eeh_add_device_tree_early+0x38/0x140
[c000000fc797bd50] c000000000051b54 .pcibios_add_pci_devices+0x34/0x190
[c000000fc797bde0] c00000000004fb10 .eeh_reset_device+0x100/0x160
[c000000fc797be70] c0000000000502dc .eeh_handle_event+0x19c/0x300
[c000000fc797bf00] c000000000050570 .eeh_event_handler+0x130/0x1a0
[c000000fc797bf90] c000000000020138 .kernel_thread+0x54/0x70

The patch changes of_node_to_eeh_dev() and just returns NULL if the
passed OF node doesn't have attached PCI_DN.

Cc: stable@vger.kernel.org
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-09-18 15:32:51 +10:00
..
Kconfig Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2012-05-22 19:22:50 -07:00
Makefile powerpc/eeh: Create PEs for PHBs 2012-09-10 09:35:30 +10:00
cmm.c power: cmm - convert sysdev_class to a regular subsystem 2011-12-21 15:09:51 -08:00
dlpar.c powerpc/pseries: Avoid spurious error during hotplug CPU add 2011-09-20 09:20:00 +10:00
dtl.c Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
eeh.c powerpc/eeh: Fix crash on converting OF node to edev 2012-09-18 15:32:51 +10:00
eeh_cache.c powerpc/eeh: Cleanup on EEH PCI address cache 2012-09-10 09:59:00 +10:00
eeh_dev.c powerpc/eeh: Create PEs for PHBs 2012-09-10 09:35:30 +10:00
eeh_driver.c powerpc/eeh: Lock module while handling EEH event 2012-09-18 15:32:48 +10:00
eeh_event.c powerpc/eeh: Handle EEH error based on PE 2012-09-10 09:35:43 +10:00
eeh_pe.c powerpc/eeh: Global mutex to protect PE tree 2012-09-18 15:32:33 +10:00
eeh_pseries.c powerpc/eeh: Probe mode support 2012-09-10 09:35:44 +10:00
eeh_sysfs.c powerpc/eeh: Move stats to PE 2012-09-10 09:35:43 +10:00
event_sources.c powerpc/pseries: Add WARN_ON() to request_event_sources_irqs() on irq allocation/request failure 2010-07-09 11:28:32 +10:00
firmware.c powerpc: Add VPHN firmware feature 2010-11-29 15:48:22 +11:00
hotplug-cpu.c Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
hotplug-memory.c Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc 2011-07-25 22:59:39 -07:00
hvCall.S powerpc: Merge STK_REG/PARAM/FRAMESIZE 2012-07-10 19:18:03 +10:00
hvCall_inst.c powerpc: Fix unpaired probe_hcall_entry and probe_hcall_exit 2012-01-03 12:09:27 +11:00
hvconsole.c powerpc: convert hvconsole.c to export.h ; fix implicit use of errno.h 2011-10-31 19:30:43 -04:00
hvcserver.c [PATCH] powerpc/pseries: Change H_StudlyCaps to H_SHOUTING_CAPS 2006-04-01 22:36:57 +11:00
io_event_irq.c powerpc: Make function that parses RTAS error logs global 2012-03-28 11:31:58 +11:00
iommu.c powerpc: Remove all includes of <asm/abs_addr.h> 2012-09-05 15:19:33 +10:00
kexec.c powerpc/pseries: Simplify vpa deregistration functions 2011-08-05 14:47:58 +10:00
lpar.c powerpc/mm: Convert virtual address to vpn 2012-09-17 16:31:49 +10:00
mobility.c of: Improve prom_update_property() function 2012-07-11 15:26:51 +10:00
msi.c powerpc/eeh: Trace error based on PE from beginning 2012-09-10 09:35:33 +10:00
nvram.c kmsg - kmsg_dump() use iterator to receive log buffer content 2012-06-15 14:53:59 -07:00
offline_states.h powerpc/smp: soft-replugged CPUs must go back to start_secondary 2011-04-01 15:37:09 +11:00
pci.c powerpc/eeh: Cleanup on EEH PCI address cache 2012-09-10 09:59:00 +10:00
pci_dlpar.c powerpc/eeh: Remove EEH PE for normal PCI hotplug 2012-09-18 15:32:23 +10:00
plpar_wrappers.h powerpc: Clean up lppaca->cede_latency_hint 2012-04-30 15:37:15 +10:00
power.c [POWERPC] Fix warning in pseries/power.c 2008-02-20 13:33:37 +11:00
processor_idle.c powerpc/cpuidle: Fixes for pseries_idle hotplug notifier 2012-07-11 14:18:35 +10:00
pseries.h powerpc/cpuidle: cpuidle driver for pSeries 2011-12-08 13:56:31 +11:00
pseries_energy.c cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem 2011-12-21 14:29:42 -08:00
ras.c Disintegrate asm/system.h for PowerPC 2012-03-28 18:30:02 +01:00
reconfig.c of: Improve prom_update_property() function 2012-07-11 15:26:51 +10:00
scanlog.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
setup.c powerpc: Dynamically calculate the dabrx based on kernel/user/hypervisor 2012-09-10 09:59:13 +10:00
smp.c powerpc/pseries/cpuidle: Replace pseries_notify_cpuidle_add call with notifier 2012-07-03 14:14:40 +10:00
suspend.c powerpc/pseries: Fix partition migration hang in stop_topology_update 2012-02-14 15:01:39 +11:00