From: Greg Kroah-Hartman Date: Thu, 8 Sep 2022 11:54:36 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v5.19.9~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=331266fc2e5097e88a7bd13d0d53ea28fd8f82fb;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch --- diff --git a/queue-4.19/driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch b/queue-4.19/driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch new file mode 100644 index 00000000000..54d72b636e7 --- /dev/null +++ b/queue-4.19/driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch @@ -0,0 +1,68 @@ +From 25e9fbf0fd38868a429feabc38abebfc6dbf6542 Mon Sep 17 00:00:00 2001 +From: "Isaac J. Manjarres" +Date: Wed, 17 Aug 2022 11:40:26 -0700 +Subject: driver core: Don't probe devices after bus_type.match() probe deferral + +From: Isaac J. Manjarres + +commit 25e9fbf0fd38868a429feabc38abebfc6dbf6542 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: 656b8035b0ee ("ARM: 8524/1: driver cohandle -EPROBE_DEFER from bus_type.match()") +Cc: stable@vger.kernel.org +Cc: Saravana Kannan +Reported-by: Guenter Roeck +Tested-by: Guenter Roeck +Tested-by: Linus Walleij +Reviewed-by: Saravana Kannan +Signed-off-by: Isaac J. Manjarres +Link: https://lore.kernel.org/r/20220817184026.3468620-1-isaacmanjarres@google.com +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/dd.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/drivers/base/dd.c ++++ b/drivers/base/dd.c +@@ -738,6 +738,11 @@ static int __device_attach_driver(struct + } else if (ret == -EPROBE_DEFER) { + dev_dbg(dev, "Device match requests probe deferral\n"); + driver_deferred_probe_add(dev); ++ /* ++ * Device can't match with a driver right now, so don't attempt ++ * to match or bind with other drivers on the bus. ++ */ ++ return ret; + } else if (ret < 0) { + dev_dbg(dev, "Bus failed to match device: %d", ret); + return ret; +@@ -891,6 +896,11 @@ static int __driver_attach(struct device + } else if (ret == -EPROBE_DEFER) { + dev_dbg(dev, "Device match requests probe deferral\n"); + driver_deferred_probe_add(dev); ++ /* ++ * Driver could not match with device, but may match with ++ * another device on the bus. ++ */ ++ return 0; + } else if (ret < 0) { + dev_dbg(dev, "Bus failed to match device: %d", ret); + return ret; diff --git a/queue-4.19/series b/queue-4.19/series index fb7ecd0f9c5..065837b3642 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -1,3 +1,4 @@ +driver-core-don-t-probe-devices-after-bus_type.match-probe-deferral.patch drm-msm-dsi-fix-the-inconsistent-indenting.patch drm-msm-dsi-fix-number-of-regulators-for-msm8996_dsi.patch platform-x86-pmc_atom-fix-slp_typx-bitfield-mask.patch