]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2019 16:28:49 +0000 (17:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Dec 2019 16:28:49 +0000 (17:28 +0100)
added patches:
driver-core-platform-use-the-correct-callback-type-for-bus_find_device.patch
usb-dwc2-use-a-longer-core-rest-timeout-in-dwc2_core_reset.patch

queue-5.4/driver-core-platform-use-the-correct-callback-type-for-bus_find_device.patch [new file with mode: 0644]
queue-5.4/series
queue-5.4/usb-dwc2-use-a-longer-core-rest-timeout-in-dwc2_core_reset.patch [new file with mode: 0644]

diff --git a/queue-5.4/driver-core-platform-use-the-correct-callback-type-for-bus_find_device.patch b/queue-5.4/driver-core-platform-use-the-correct-callback-type-for-bus_find_device.patch
new file mode 100644 (file)
index 0000000..c0b3dec
--- /dev/null
@@ -0,0 +1,51 @@
+From 492c88720d36eb662f9f10c1633f7726fbb07fc4 Mon Sep 17 00:00:00 2001
+From: Sami Tolvanen <samitolvanen@google.com>
+Date: Tue, 12 Nov 2019 13:41:56 -0800
+Subject: driver core: platform: use the correct callback type for bus_find_device
+
+From: Sami Tolvanen <samitolvanen@google.com>
+
+commit 492c88720d36eb662f9f10c1633f7726fbb07fc4 upstream.
+
+platform_find_device_by_driver calls bus_find_device and passes
+platform_match as the callback function. Casting the function to a
+mismatching type trips indirect call Control-Flow Integrity (CFI) checking.
+
+This change adds a callback function with the correct type and instead
+of casting the function, explicitly casts the second parameter to struct
+device_driver* as expected by platform_match.
+
+Fixes: 36f3313d6bff9 ("platform: Add platform_find_device_by_driver() helper")
+Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20191112214156.3430-1-samitolvanen@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/platform.c |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/base/platform.c
++++ b/drivers/base/platform.c
+@@ -1278,6 +1278,11 @@ struct bus_type platform_bus_type = {
+ };
+ EXPORT_SYMBOL_GPL(platform_bus_type);
++static inline int __platform_match(struct device *dev, const void *drv)
++{
++      return platform_match(dev, (struct device_driver *)drv);
++}
++
+ /**
+  * platform_find_device_by_driver - Find a platform device with a given
+  * driver.
+@@ -1288,7 +1293,7 @@ struct device *platform_find_device_by_d
+                                             const struct device_driver *drv)
+ {
+       return bus_find_device(&platform_bus_type, start, drv,
+-                             (void *)platform_match);
++                             __platform_match);
+ }
+ EXPORT_SYMBOL_GPL(platform_find_device_by_driver);
index 4aaff741cdb2374a5eaf58807d515cd30e5adf5f..029bc55d1dfa4324ee1e023cfe84b61083caf9c2 100644 (file)
@@ -2,3 +2,5 @@ io_uring-async-workers-should-inherit-the-user-creds.patch
 net-separate-out-the-msghdr-copy-from-___sys_-send-r.patch
 net-disallow-ancillary-data-for-__sys_-send-recv-msg.patch
 crypto-inside-secure-fix-stability-issue-with-macchiatobin.patch
+driver-core-platform-use-the-correct-callback-type-for-bus_find_device.patch
+usb-dwc2-use-a-longer-core-rest-timeout-in-dwc2_core_reset.patch
diff --git a/queue-5.4/usb-dwc2-use-a-longer-core-rest-timeout-in-dwc2_core_reset.patch b/queue-5.4/usb-dwc2-use-a-longer-core-rest-timeout-in-dwc2_core_reset.patch
new file mode 100644 (file)
index 0000000..354501a
--- /dev/null
@@ -0,0 +1,40 @@
+From 6689f0f4bb14e50917ba42eb9b41c25e0184970c Mon Sep 17 00:00:00 2001
+From: Mathias Kresin <dev@kresin.me>
+Date: Sun, 7 Jul 2019 16:22:01 +0200
+Subject: usb: dwc2: use a longer core rest timeout in dwc2_core_reset()
+
+From: Mathias Kresin <dev@kresin.me>
+
+commit 6689f0f4bb14e50917ba42eb9b41c25e0184970c upstream.
+
+Testing on different generations of Lantiq MIPS SoC based boards, showed
+that it takes up to 1500 us until the core reset bit is cleared.
+
+The driver from the vendor SDK (ifxhcd) uses a 1 second timeout. Use the
+same timeout to fix wrong hang detections and make the driver work for
+Lantiq MIPS SoCs.
+
+At least till kernel 4.14 the hanging reset only caused a warning but
+the driver was probed successful. With kernel 4.19 errors out with
+EBUSY.
+
+Cc: linux-stable <stable@vger.kernel.org> # 4.19+
+Signed-off-by: Mathias Kresin <dev@kresin.me>
+Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/core.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/dwc2/core.c
++++ b/drivers/usb/dwc2/core.c
+@@ -524,7 +524,7 @@ int dwc2_core_reset(struct dwc2_hsotg *h
+       greset |= GRSTCTL_CSFTRST;
+       dwc2_writel(hsotg, greset, GRSTCTL);
+-      if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_CSFTRST, 50)) {
++      if (dwc2_hsotg_wait_bit_clear(hsotg, GRSTCTL, GRSTCTL_CSFTRST, 10000)) {
+               dev_warn(hsotg->dev, "%s: HANG! Soft Reset timeout GRSTCTL GRSTCTL_CSFTRST\n",
+                        __func__);
+               return -EBUSY;