linux/arch/s390
Vineeth Vijayan 0c6924c262 s390/cio: introduce locking for register/unregister functions
Unbinding an I/O subchannel with a child-CCW device in disconnected
state sometimes causes a kernel-panic. The race condition was seen
mostly during testing, when setting all the CHPIDs of a device to
offline and at the same time, the unbinding the I/O subchannel driver.

The kernel-panic occurs because of double delete, the I/O subchannel
driver calls device_del on the CCW device while another device_del
invocation for the same device is in-flight.  For instance, disabling
all the CHPIDs will trigger the ccw_device_remove function, which will
call a ccw_device_unregister(), which ends up calling the device_del()
which is asynchronous via cdev's todo workqueue. And unbinding the I/O
subchannel driver calls io_subchannel_remove() function which calls the
ccw_device_unregister() and device_del().

This double delete can be prevented by serializing all CCW device
registration/unregistration calls into the driver core. This patch
introduces a mutex which will be used for this purpose.

Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
2023-01-31 18:56:36 +01:00
..
appldata s390/appldata: remove power management callbacks 2022-12-02 18:25:04 +01:00
boot s390/boot: remove pgtable_populate_end 2023-01-31 18:56:36 +01:00
configs s390: update defconfigs 2023-01-11 21:26:40 +01:00
crypto s390/archrandom: add missing header include 2023-01-10 14:39:08 +01:00
hypfs s390/hypfs: remove unused info_blk_hdr__pcpus() function 2022-11-23 16:24:07 +01:00
include s390/cio: introduce locking for register/unregister functions 2023-01-31 18:56:36 +01:00
kernel s390: discard .interp section 2023-01-25 20:51:10 +01:00
kvm KVM: s390: interrupt: use READ_ONCE() before cmpxchg() 2023-01-11 15:28:47 +01:00
lib s390/kprobes: replace kretprobe with rethook 2023-01-22 18:42:35 +01:00
mm s390/mm,ptdump: avoid Kasan vs Memcpy Real markers swapping 2023-01-31 18:56:36 +01:00
net s390/bpf: Fix typo in comment 2022-05-23 11:25:53 -07:00
pci IOMMU Updates for Linux v6.2 2022-12-19 08:34:39 -06:00
purgatory s390/purgatory: remove duplicated build rule of kexec-purgatory.o 2022-06-30 14:18:16 +02:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild
Kconfig s390/kprobes: replace kretprobe with rethook 2023-01-22 18:42:35 +01:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile s390: always build relocatable kernel 2022-11-08 19:32:32 +01:00