]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.5-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Mar 2020 15:10:42 +0000 (17:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 30 Mar 2020 15:10:42 +0000 (17:10 +0200)
added patches:
r8169-fix-phy-driver-check-on-platforms-w-o-module-softdeps.patch

queue-5.5/r8169-fix-phy-driver-check-on-platforms-w-o-module-softdeps.patch [new file with mode: 0644]
queue-5.5/series

diff --git a/queue-5.5/r8169-fix-phy-driver-check-on-platforms-w-o-module-softdeps.patch b/queue-5.5/r8169-fix-phy-driver-check-on-platforms-w-o-module-softdeps.patch
new file mode 100644 (file)
index 0000000..b951c84
--- /dev/null
@@ -0,0 +1,57 @@
+From 2e8c339b4946490a922a21aa8cd869c6cfad2023 Mon Sep 17 00:00:00 2001
+From: Heiner Kallweit <hkallweit1@gmail.com>
+Date: Fri, 27 Mar 2020 17:33:32 +0100
+Subject: r8169: fix PHY driver check on platforms w/o module softdeps
+
+From: Heiner Kallweit <hkallweit1@gmail.com>
+
+commit 2e8c339b4946490a922a21aa8cd869c6cfad2023 upstream.
+
+On Android/x86 the module loading infrastructure can't deal with
+softdeps. Therefore the check for presence of the Realtek PHY driver
+module fails. mdiobus_register() will try to load the PHY driver
+module, therefore move the check to after this call and explicitly
+check that a dedicated PHY driver is bound to the PHY device.
+
+Fixes: f32593773549 ("r8169: check that Realtek PHY driver module is loaded")
+Reported-by: Chih-Wei Huang <cwhuang@android-x86.org>
+Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/net/ethernet/realtek/r8169_main.c |   16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/ethernet/realtek/r8169_main.c
++++ b/drivers/net/ethernet/realtek/r8169_main.c
+@@ -6670,6 +6670,13 @@ static int r8169_mdio_register(struct rt
+       if (!tp->phydev) {
+               mdiobus_unregister(new_bus);
+               return -ENODEV;
++      } else if (!tp->phydev->drv) {
++              /* Most chip versions fail with the genphy driver.
++               * Therefore ensure that the dedicated PHY driver is loaded.
++               */
++              dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
++              mdiobus_unregister(new_bus);
++              return -EUNATCH;
+       }
+       /* PHY will be woken up in rtl_open() */
+@@ -6831,15 +6838,6 @@ static int rtl_init_one(struct pci_dev *
+       int chipset, region;
+       int jumbo_max, rc;
+-      /* Some tools for creating an initramfs don't consider softdeps, then
+-       * r8169.ko may be in initramfs, but realtek.ko not. Then the generic
+-       * PHY driver is used that doesn't work with most chip versions.
+-       */
+-      if (!driver_find("RTL8201CP Ethernet", &mdio_bus_type)) {
+-              dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
+-              return -ENOENT;
+-      }
+-
+       dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp));
+       if (!dev)
+               return -ENOMEM;
index c361214f2c319410c046f31d3b7c5750ef4c5e2e..33f00ed3684a1b05777867204db3a09e4487ef3e 100644 (file)
@@ -143,3 +143,4 @@ bpf-btf-fix-btf-verification-of-enum-members-in-struct-union.patch
 bpf-sockmap-remove-bucket-lock-from-sock_-hash-map-_free.patch
 arm-dts-sun8i-a83t-tbs-a711-fix-usb-otg-mode-detection.patch
 vti6-fix-memory-leak-of-skb-if-input-policy-check-fails.patch
+r8169-fix-phy-driver-check-on-platforms-w-o-module-softdeps.patch