linux-stable/drivers/base
Isaac J. Manjarres d574fee3d4 driver core: Don't probe devices after bus_type.match() probe deferral
commit 25e9fbf0fd upstream.

Both __device_attach_driver() and __driver_attach() check the return
code of the bus_type.match() function to see if the device needs to be
added to the deferred probe list. After adding the device to the list,
the logic attempts to bind the device to the driver anyway, as if the
device had matched with the driver, which is not correct.

If __device_attach_driver() detects that the device in question is not
ready to match with a driver on the bus, then it doesn't make sense for
the device to attempt to bind with the current driver or continue
attempting to match with any of the other drivers on the bus. So, update
the logic in __device_attach_driver() to reflect this.

If __driver_attach() detects that a driver tried to match with a device
that is not ready to match yet, then the driver should not attempt to bind
with the device. However, the driver can still attempt to match and bind
with other devices on the bus, as drivers can be bound to multiple
devices. So, update the logic in __driver_attach() to reflect this.

Fixes: 656b8035b0 ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()")
Cc: stable@vger.kernel.org
Cc: Saravana Kannan <saravanak@google.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Saravana Kannan <saravanak@google.com>
Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
Link: https://lore.kernel.org/r/20220817184026.3468620-1-isaacmanjarres@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-09-15 12:39:46 +02:00
..
power PM: core: keep irq flags in device_pm_check_callbacks() 2022-04-20 09:06:38 +02:00
regmap regmap: Fix possible double-free in regcache_rbtree_exit() 2021-11-02 17:39:23 +01:00
Kconfig sysfs/cpu: Add vulnerability folder 2018-01-17 09:38:57 +01:00
Makefile
attribute_container.c
base.h
bus.c sysfs: Disable lockdep for driver bind/unbind files 2019-01-26 09:38:35 +01:00
cacheinfo.c drivers: base: cacheinfo: fix boot error message when acpi is enabled 2018-01-31 12:55:51 +01:00
class.c
component.c component: Silence bind error on -EPROBE_DEFER 2020-05-27 16:41:46 +02:00
container.c
core.c PCI/MSI: Protect msi_desc::masked for multi-MSI 2021-08-26 08:37:24 -04:00
cpu.c x86/speculation/mmio: Add sysfs reporting for Processor MMIO Stale Data 2022-06-16 13:00:52 +02:00
dd.c driver core: Don't probe devices after bus_type.match() probe deferral 2022-09-15 12:39:46 +02:00
devcoredump.c
devres.c
devtmpfs.c
dma-coherent.c
dma-contiguous.c
dma-mapping.c
driver.c
firmware.c
firmware_class.c firmware: fix usermode helper fallback loading 2017-01-09 08:32:22 +01:00
hypervisor.c
init.c
isa.c isa: Prevent NULL dereference in isa_bus driver callbacks 2017-12-14 09:28:11 +01:00
map.c
memory.c mm/memory_hotplug: Do not unlock when fails to take the device_hotplug_lock 2019-11-28 18:29:02 +01:00
module.c
node.c drivers/base/node.c: fix compaction sysfs file leak 2022-06-14 16:52:33 +02:00
pinctrl.c
platform-msi.c platform-msi: Free descriptors in platform_msi_domain_free() 2019-01-09 16:16:43 +01:00
platform.c drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish 2020-06-30 15:38:24 -04:00
property.c device property: Track owner device of device property 2017-10-18 09:35:39 +02:00
soc.c base: soc: Export soc_device_register/unregister APIs 2019-10-05 12:30:20 +02:00
syscore.c
topology.c
transport_class.c