linux/arch/arm
Grygorii Strashko 213fa10db2 ARM: OMAP2+: omap_device: fix crash on omap_device removal
Below call chain causes system crash when OMAP device is
removed by calling of_platform_depopulate()/device_del():

device_del()
- blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
 			     BUS_NOTIFY_DEL_DEVICE, dev);
  - _omap_device_notifier_call()
    - omap_device_delete()
      - od->pdev->archdata.od = NULL;
	kfree(od->hwmods);
	kfree(od);
  - bus_remove_device()
    - device_release_driver()
      - __device_release_driver()
	- pm_runtime_get_sync()
	   - _od_runtime_resume()
	     - omap_hwmod_enable() <- OOPS od's delted already

Backtrace:
Unable to handle kernel NULL pointer dereference at virtual address 0000000d
pgd = eb100000
[0000000d] *pgd=ad6e1831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] PREEMPT SMP ARM
CPU: 1 PID: 1273 Comm: modprobe Not tainted 4.4.15-rt19-00115-ge4d3cd3-dirty #68
Hardware name: Generic DRA74X (Flattened Device Tree)
task: eb1ee800 ti: ec962000 task.ti: ec962000
PC is at omap_device_enable+0x10/0x90
LR is at _od_runtime_resume+0x10/0x24
[...]
[<c00299dc>] (omap_device_enable) from [<c0029a6c>] (_od_runtime_resume+0x10/0x24)
[<c0029a6c>] (_od_runtime_resume) from [<c04ad404>] (__rpm_callback+0x20/0x34)
[<c04ad404>] (__rpm_callback) from [<c04ad438>] (rpm_callback+0x20/0x80)
[<c04ad438>] (rpm_callback) from [<c04aee28>] (rpm_resume+0x48c/0x964)
[<c04aee28>] (rpm_resume) from [<c04af360>] (__pm_runtime_resume+0x60/0x88)
[<c04af360>] (__pm_runtime_resume) from [<c04a4974>] (__device_release_driver+0x30/0x100)
[<c04a4974>] (__device_release_driver) from [<c04a4a60>] (device_release_driver+0x1c/0x28)
[<c04a4a60>] (device_release_driver) from [<c04a38c0>] (bus_remove_device+0xec/0x144)
[<c04a38c0>] (bus_remove_device) from [<c04a0764>] (device_del+0x10c/0x210)
[<c04a0764>] (device_del) from [<c04a67b0>] (platform_device_del+0x18/0x84)
[<c04a67b0>] (platform_device_del) from [<c04a6828>] (platform_device_unregister+0xc/0x20)
[<c04a6828>] (platform_device_unregister) from [<c05adcfc>] (of_platform_device_destroy+0x8c/0x90)
[<c05adcfc>] (of_platform_device_destroy) from [<c04a02f0>] (device_for_each_child+0x4c/0x78)
[<c04a02f0>] (device_for_each_child) from [<c05adc5c>] (of_platform_depopulate+0x30/0x44)
[<c05adc5c>] (of_platform_depopulate) from [<bf123920>] (cpsw_remove+0x68/0xf4 [ti_cpsw])
[<bf123920>] (cpsw_remove [ti_cpsw]) from [<c04a68d8>] (platform_drv_remove+0x24/0x3c)
[<c04a68d8>] (platform_drv_remove) from [<c04a49c8>] (__device_release_driver+0x84/0x100)
[<c04a49c8>] (__device_release_driver) from [<c04a4b20>] (driver_detach+0xac/0xb0)
[<c04a4b20>] (driver_detach) from [<c04a3be8>] (bus_remove_driver+0x60/0xd4)
[<c04a3be8>] (bus_remove_driver) from [<c00d9870>] (SyS_delete_module+0x184/0x20c)
[<c00d9870>] (SyS_delete_module) from [<c0010540>] (ret_fast_syscall+0x0/0x1c)
Code: e3500000 e92d4070 1590630c 01a06000 (e5d6300d)

Hence, fix it by using BUS_NOTIFY_REMOVED_DEVICE event for OMAP device
deletion which is sent when DD has finished processing of device
deletion.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Tero Kristo <t-kristo@ti.com>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-30 21:00:34 -07:00
..
boot Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-07-29 13:03:49 -07:00
common
configs arm: use the new LED disk activity trigger 2016-06-27 08:58:40 +02:00
crypto crypto: ghash-ce - Fix cryptd reordering 2016-06-23 18:29:54 +08:00
firmware
include Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-07-29 13:03:49 -07:00
kernel Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security 2016-07-29 17:38:46 -07:00
kvm KVM: arm/arm64: Stop leaking vcpu pid references 2016-06-27 13:08:10 +02:00
lib ARM: 8306/1: loop_udelay: remove bogomips value limitation 2016-06-22 19:55:12 +01:00
mach-alpine
mach-artpec
mach-asm9260
mach-aspeed arm: Add Aspeed machine 2016-05-09 17:41:14 +09:30
mach-at91
mach-axxia
mach-bcm clocksource/drivers/bcm_kona: Add the COMPILE_TEST option 2016-06-28 10:22:06 +02:00
mach-berlin cpufreq: berlin: Use generic platdev driver 2016-04-25 16:18:23 +02:00
mach-clps711x
mach-cns3xxx
mach-davinci arm: use the new LED disk activity trigger 2016-06-27 08:58:40 +02:00
mach-digicolor
mach-dove ARM: dove: Remove CLK_IS_ROOT 2016-04-27 13:55:52 +02:00
mach-ebsa110
mach-efm32
mach-ep93xx
mach-exynos Two fixes for v4.7 cycle for build issues: 2016-06-03 12:15:00 -07:00
mach-footbridge
mach-gemini
mach-highbank
mach-hisi
mach-imx ARM: imx6ul: Fix Micrel PHY mask 2016-06-09 20:49:29 +08:00
mach-integrator clocksource/drivers/integrator-ap: Add the COMPILE_TEST option 2016-06-28 10:22:16 +02:00
mach-iop13xx
mach-iop32x
mach-iop33x
mach-ixp4xx
mach-keystone clocksource/drivers/keystone: Add the COMPILE_TEST option 2016-06-28 10:22:15 +02:00
mach-ks8695
mach-lpc18xx
mach-lpc32xx ARM: lpc32xx: fix NR_IRQS confict 2016-05-24 19:32:46 +00:00
mach-mediatek ARM: SoC driver updates for v4.7 2016-05-18 13:14:02 -07:00
mach-meson
mach-mmp
mach-moxart clocksource/drivers/moxart: Add the COMPILE_TEST option 2016-06-28 10:22:08 +02:00
mach-mv78xx0 ARM: mv78xx0: Remove CLK_IS_ROOT 2016-04-27 12:42:55 +02:00
mach-mvebu Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
mach-mxs clocksource/drivers/mxs: Add the COMPILE_TEST option 2016-06-28 10:22:10 +02:00
mach-netx
mach-nomadik
mach-nspire clocksource/drivers/nspire: Add the COMPILE_TEST option 2016-06-28 10:22:14 +02:00
mach-omap1 arm: use the new LED disk activity trigger 2016-06-27 08:58:40 +02:00
mach-omap2 ARM: OMAP2+: omap_device: fix crash on omap_device removal 2016-07-30 21:00:34 -07:00
mach-orion5x ARM: orion5x: Remove CLK_IS_ROOT 2016-04-27 13:11:42 +02:00
mach-oxnas ARM: Add new mach-oxnas 2016-04-26 09:50:52 +02:00
mach-picoxcell
mach-prima2 clocksource/drivers/prima2: Add the COMPILE_TEST option 2016-06-28 10:22:12 +02:00
mach-pxa arm: use the new LED disk activity trigger 2016-06-27 08:58:40 +02:00
mach-qcom
mach-realview
mach-rockchip ARM: SoC cleanups and fixes for v4.7 2016-05-18 12:28:29 -07:00
mach-rpc
mach-s3c24xx ARM: Explicitly apply PWM config extracted from pwm_args 2016-05-17 14:45:08 +02:00
mach-s3c64xx
mach-s5pv210
mach-sa1100
mach-shmobile ARM: SoC driver updates for v4.7 2016-05-18 13:14:02 -07:00
mach-socfpga * Altera Arria10 L2 cache and On-Chip RAM ECC handling. (Thor Thayer) 2016-05-16 18:44:39 -07:00
mach-spear
mach-sti
mach-stm32
mach-sunxi cpufreq: sunxi: Use generic platdev driver 2016-04-25 16:18:24 +02:00
mach-tango
mach-tegra ARM: SoC driver updates for v4.7 2016-05-18 13:14:02 -07:00
mach-u300 clocksource/drivers/u300: Add the COMPILE_TEST option 2016-06-28 10:22:13 +02:00
mach-uniphier ARM: SoC platform updates for v4.7 2016-05-18 12:35:46 -07:00
mach-ux500
mach-versatile
mach-vexpress vexpress/spc: Remove CLK_IS_ROOT 2016-06-01 14:48:01 -07:00
mach-vt8500
mach-w90x900
mach-zx
mach-zynq cpufreq: zynq: Use generic platdev driver 2016-04-25 16:18:24 +02:00
mm Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
net
nwfpe
oprofile
plat-iop
plat-omap
plat-orion
plat-pxa
plat-samsung Two fixes for v4.7 cycle for build issues: 2016-06-03 12:15:00 -07:00
plat-versatile
probes
tools ARM: 8562/1: suppress "include/generated/mach-types.h is up to date." 2016-04-19 19:42:47 +01:00
vdso kbuild: drop FORCE from PHONY targets 2016-04-20 10:27:20 +02:00
vfp arm: Convert VFP hotplug notifiers to state machine 2016-07-15 10:40:22 +02:00
xen Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-29 13:55:30 -07:00
Kconfig Merge branch 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm 2016-07-29 13:03:49 -07:00
Kconfig-nommu
Kconfig.debug ARM: debug: remove extraneous DEBUG_HI3716_UART option 2016-04-26 13:00:11 +02:00
Makefile ARM: 8576/1: avoid duplicating "Kernel: arch/arm/boot/*Image is ready" 2016-06-22 19:55:12 +01:00