The patch
spi: stm32-qspi: Fix kernel oops when unbinding driver
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 3c0af1dd2fe78adc02fe21f6cfe7d6cb8602573e Mon Sep 17 00:00:00 2001
From: Patrice Chotard
Date: Fri, 4 Oct 2019 14:36:06 +0200
Subject: [PATCH] spi: stm32-qspi: Fix kernel oops when unbinding driver
spi_master_put() must only be called in .probe() in case of error.
As devm_spi_register_master() is used during probe, spi_master_put()
mustn't be called in .remove() callback.
It fixes the following kernel WARNING/Oops when executing
echo "58003000.spi" > /sys/bus/platform/drivers/stm32-qspi/unbind :
[ cut here ]
WARNING: CPU: 1 PID: 496 at fs/kernfs/dir.c:1504
kernfs_remove_by_name_ns+0x9c/0xa4
kernfs: can not remove 'uevent', no directory
Modules linked in:
CPU: 1 PID: 496 Comm: sh Not tainted 5.3.0-rc1-00219-ga0e07bb51a37 #62
Hardware name: STM32 (Device Tree Support)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0xb4/0xc8)
[] (dump_stack) from [] (__warn.part.3+0xbc/0xd8)
[] (__warn.part.3) from [] (warn_slowpath_fmt+0x68/0x8c)
[] (warn_slowpath_fmt) from []
(kernfs_remove_by_name_ns+0x9c/0xa4)
[] (kernfs_remove_by_name_ns) from []
(device_del+0x128/0x358)
[] (device_del) from [] (device_unregister+0x24/0x64)
[] (device_unregister) from []
(spi_unregister_controller+0x88/0xe8)
[] (spi_unregister_controller) from []
(release_nodes+0x1bc/0x200)
[] (release_nodes) from []
(device_release_driver_internal+0xec/0x1ac)
[] (device_release_driver_internal) from []
(unbind_store+0x60/0xd4)
[] (unbind_store) from [] (kernfs_fop_write+0xe8/0x1c4)
[] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x1c0)
[] (__vfs_write) from [] (vfs_write+0xa4/0x184)
[] (vfs_write) from [] (ksys_write+0x58/0xd0)
[] (ksys_write) from [] (ret_fast_syscall+0x0/0x54)
Exception stack(0xdd289fa8 to 0xdd289ff0)
9fa0: 006c 000e20e8 0001 000e20e8 000d
9fc0: 006c 000e20e8 b6f87da0 0004 000d 000d
9fe0: 0004 bee639b0 b6f2286b b6eaf6c6
---[ end trace 1b15df8a02d76aef ]---
[ cut here ]
WARNING: CPU: 1 PID: 496 at fs/kernfs/dir.c:1504
kernfs_remove_by_name_ns+0x9c/0xa4
kernfs: can not remove 'online', no directory
Modules linked in:
CPU: 1 PID: 496 Comm: sh Tainted: GW
5.3.0-rc1-00219-ga0e07bb51a37 #62
Hardware name: STM32 (Device Tree Support)
[] (unwind_backtrace) from [] (show_stack+0x10/0x14)
[] (show_stack) from [] (dump_stack+0xb4/0xc8)
[] (dump_stack) from [] (__warn.part.3+0xbc/0xd8)
[] (__warn.part.3) from [] (warn_slowpath_fmt+0x68/0x8c)
[] (warn_slowpath_fmt) from []
(kernfs_remove_by_name_ns+0x9c/0xa4)
[] (kernfs_remove_by_name_ns) from []
(device_remove_attrs+0x20/0x5c)
[] (device_remove_attrs) from [] (device_del+0x134/0x358)
[] (device_del) from [] (device_unregister+0x24/0x64)
[] (device_unregister) from []
(spi_unregister_controller+0x88/0xe8)
[] (spi_unregister_controller) from []
(release_nodes+0x1bc/0x200)
[] (release_nodes) from []
(device_release_driver_internal+0xec/0x1ac)
[] (device_release_driver_internal) from []
(unbind_store+0x60/0xd4)
[] (unbind_store) from [] (kernfs_fop_write+0xe8/0x1c4)
[] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x1c0)
[] (__vfs_write) from [] (vfs_write+0xa4/0x184)
[] (vfs_write) from [] (ksys_write+0x58/0xd0)
[] (ksys_write) from [] (ret_fast_syscall+0x0/0x54)
Exception stack(0xdd289fa8 to 0xdd289ff0)
9fa0: 006c 000e20e8 0001 000e20e8 000d
9fc0: 006c 000e20e8 b6f87da0 0004 000d 000d
9fe0: 0004 bee639b0 b6f2286b b6eaf6c6
---[ end trace 1b15df8a02d76af0 ]---
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 0050
pgd = e612f14d
[0050] *pgd=ff1f5835
Internal error: Oops: 17 [#1] SMP ARM
Modules linked in:
CPU: 1 PID: 496 Comm: sh Tainted: GW
5.3.0-rc1-00219-ga0e07bb51a37 #62
Hardware name: STM32 (Device Tree Support)
PC is at kernfs_find_ns+0x8/0xfc
LR is at kernfs_find_and_get_ns+0x30/0x48
pc : []lr : []