This is a note to let you know that I've just added the patch titled driver core: Avoid binding drivers to dead devices to the 5.7-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: driver-core-avoid-binding-drivers-to-dead-devices.patch and it can be found in the queue-5.7 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 654888327e9f655a9d55ad477a9583e90e8c9b5c Mon Sep 17 00:00:00 2001 From: Lukas Wunner <lukas@xxxxxxxxx> Date: Wed, 8 Jul 2020 15:27:01 +0200 Subject: driver core: Avoid binding drivers to dead devices From: Lukas Wunner <lukas@xxxxxxxxx> commit 654888327e9f655a9d55ad477a9583e90e8c9b5c upstream. Commit 3451a495ef24 ("driver core: Establish order of operations for device_add and device_del via bitflag") sought to prevent asynchronous driver binding to a device which is being removed. It added a per-device "dead" flag which is checked in the following code paths: * asynchronous binding in __driver_attach_async_helper() * synchronous binding in device_driver_attach() * asynchronous binding in __device_attach_async_helper() It did *not* check the flag upon: * synchronous binding in __device_attach() However __device_attach() may also be called asynchronously from: deferred_probe_work_func() bus_probe_device() device_initial_probe() __device_attach() So if the commit's intention was to check the "dead" flag in all asynchronous code paths, then a check is also necessary in __device_attach(). Add the missing check. Fixes: 3451a495ef24 ("driver core: Establish order of operations for device_add and device_del via bitflag") Signed-off-by: Lukas Wunner <lukas@xxxxxxxxx> Cc: stable@xxxxxxxxxxxxxxx # v5.1+ Cc: Alexander Duyck <alexander.h.duyck@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/r/de88a23a6fe0ef70f7cfd13c8aea9ab51b4edab6.1594214103.git.lukas@xxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/base/dd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -846,7 +846,9 @@ static int __device_attach(struct device int ret = 0; device_lock(dev); - if (dev->driver) { + if (dev->p->dead) { + goto out_unlock; + } else if (dev->driver) { if (device_is_bound(dev)) { ret = 1; goto out_unlock; Patches currently in stable-queue which might be from lukas@xxxxxxxxx are queue-5.7/driver-core-avoid-binding-drivers-to-dead-devices.patch queue-5.7/appletalk-fix-atalk_proc_init-return-path.patch