mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-23 15:17:01 +00:00
smp_rescan_cpus() is called without the device_hotplug_lock, which can lead
to a dedlock when a new CPU is found and immediately set online by a udev
rule.
This was observed on an older kernel version, where the cpu_hotplug_begin()
loop was still present, and it resulted in hanging chcpu and systemd-udev
processes. This specific deadlock will not show on current kernels. However,
there may be other possible deadlocks, and since smp_rescan_cpus() can still
trigger a CPU hotplug operation, the device_hotplug_lock should be held.
For reference, this was the deadlock with the old cpu_hotplug_begin() loop:
chcpu (rescan) systemd-udevd
echo 1 > /sys/../rescan
-> smp_rescan_cpus()
-> (*) get_online_cpus()
(increases refcount)
-> smp_add_present_cpu()
(new CPU found)
-> register_cpu()
-> device_add()
-> udev "add" event triggered -----------> udev rule sets CPU online
-> echo 1 > /sys/.../online
-> lock_device_hotplug_sysfs()
(this is missing in rescan path)
-> device_online()
-> (**) device_lock(new CPU dev)
-> cpu_up()
-> cpu_hotplug_begin()
(loops until refcount == 0)
-> deadlock with (*)
-> bus_probe_device()
-> device_attach()
-> device_lock(new CPU dev)
-> deadlock with (**)
Fix this by taking the device_hotplug_lock in the CPU rescan path.
Cc: <stable@vger.kernel.org>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
|
||
|---|---|---|
| .. | ||
| con3215.c | ||
| con3270.c | ||
| ctrlchar.c | ||
| ctrlchar.h | ||
| defkeymap.c | ||
| defkeymap.map | ||
| diag_ftp.c | ||
| diag_ftp.h | ||
| fs3270.c | ||
| hmcdrv_cache.c | ||
| hmcdrv_cache.h | ||
| hmcdrv_dev.c | ||
| hmcdrv_dev.h | ||
| hmcdrv_ftp.c | ||
| hmcdrv_ftp.h | ||
| hmcdrv_mod.c | ||
| Kconfig | ||
| keyboard.c | ||
| keyboard.h | ||
| Makefile | ||
| monreader.c | ||
| monwriter.c | ||
| raw3270.c | ||
| raw3270.h | ||
| sclp.c | ||
| sclp.h | ||
| sclp_async.c | ||
| sclp_cmd.c | ||
| sclp_con.c | ||
| sclp_config.c | ||
| sclp_cpi_sys.c | ||
| sclp_cpi_sys.h | ||
| sclp_ctl.c | ||
| sclp_diag.h | ||
| sclp_early.c | ||
| sclp_early_core.c | ||
| sclp_ftp.c | ||
| sclp_ftp.h | ||
| sclp_ocf.c | ||
| sclp_pci.c | ||
| sclp_quiesce.c | ||
| sclp_rw.c | ||
| sclp_rw.h | ||
| sclp_sd.c | ||
| sclp_sdias.c | ||
| sclp_sdias.h | ||
| sclp_tty.c | ||
| sclp_tty.h | ||
| sclp_vt220.c | ||
| tape.h | ||
| tape_34xx.c | ||
| tape_3590.c | ||
| tape_3590.h | ||
| tape_char.c | ||
| tape_class.c | ||
| tape_class.h | ||
| tape_core.c | ||
| tape_proc.c | ||
| tape_std.c | ||
| tape_std.h | ||
| tty3270.c | ||
| tty3270.h | ||
| vmcp.c | ||
| vmlogrdr.c | ||
| vmur.c | ||
| vmur.h | ||
| zcore.c | ||