From 0853d73ec1301999b21d6133ecb9ad70d08d20d3 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Tue, 10 Apr 2018 09:40:51 +0200 Subject: [PATCH] Update patches for brcm2708 --- ...-lan78xx_writ_reg-Workqueue-events-l.patch | 86 +++++++++++++++++++ ...est-s-w-csum-check-on-VLAN-tagged-pa.patch | 45 ++++++++++ 2 files changed, 131 insertions(+) create mode 100644 root/target/linux/brcm2708/patches-4.14/0298-lan78xx-Crash-in-lan78xx_writ_reg-Workqueue-events-l.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0299-net-lan78xx-Request-s-w-csum-check-on-VLAN-tagged-pa.patch diff --git a/root/target/linux/brcm2708/patches-4.14/0298-lan78xx-Crash-in-lan78xx_writ_reg-Workqueue-events-l.patch b/root/target/linux/brcm2708/patches-4.14/0298-lan78xx-Crash-in-lan78xx_writ_reg-Workqueue-events-l.patch new file mode 100644 index 00000000..571084a1 --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0298-lan78xx-Crash-in-lan78xx_writ_reg-Workqueue-events-l.patch @@ -0,0 +1,86 @@ +From b26ec5dc683f3e77ca72701c5c90e670c3286303 Mon Sep 17 00:00:00 2001 +From: Raghuram Chary J +Date: Tue, 27 Mar 2018 14:51:16 +0530 +Subject: [PATCH 298/299] lan78xx: Crash in lan78xx_writ_reg (Workqueue: events + lan78xx_deferred_multicast_write) + +commit 2d2d99ec13f62d5d2cecb6169dfdb6bbe05356d0 upstream. + +Description: +Crash was reported with syzkaller pointing to lan78xx_write_reg routine. + +Root-cause: +Proper cleanup of workqueues and init/setup routines was not happening +in failure conditions. + +Fix: +Handled the error conditions by cleaning up the queues and init/setup +routines. + +Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver") +Reported-by: Andrey Konovalov +Signed-off-by: Raghuram Chary J +Signed-off-by: David S. Miller +--- + drivers/net/usb/lan78xx.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 3bc5ce4b73f9..e7cac41d6042 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -2915,8 +2915,7 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) + if (ret < 0) { + netdev_warn(dev->net, + "lan78xx_setup_irq_domain() failed : %d", ret); +- kfree(pdata); +- return ret; ++ goto out1; + } + + dev->net->hard_header_len += TX_OVERHEAD; +@@ -2924,14 +2923,32 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) + + /* Init all registers */ + ret = lan78xx_reset(dev); ++ if (ret) { ++ netdev_warn(dev->net, "Registers INIT FAILED...."); ++ goto out2; ++ } + + ret = lan78xx_mdio_init(dev); ++ if (ret) { ++ netdev_warn(dev->net, "MDIO INIT FAILED....."); ++ goto out2; ++ } + + dev->net->flags |= IFF_MULTICAST; + + pdata->wol = WAKE_MAGIC; + + return ret; ++ ++out2: ++ lan78xx_remove_irq_domain(dev); ++ ++out1: ++ netdev_warn(dev->net, "Bind routine FAILED"); ++ cancel_work_sync(&pdata->set_multicast); ++ cancel_work_sync(&pdata->set_vlan); ++ kfree(pdata); ++ return ret; + } + + static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf) +@@ -2943,6 +2960,8 @@ static void lan78xx_unbind(struct lan78xx_net *dev, struct usb_interface *intf) + lan78xx_remove_mdio(dev); + + if (pdata) { ++ cancel_work_sync(&pdata->set_multicast); ++ cancel_work_sync(&pdata->set_vlan); + netif_dbg(dev, ifdown, dev->net, "free pdata"); + kfree(pdata); + pdata = NULL; +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0299-net-lan78xx-Request-s-w-csum-check-on-VLAN-tagged-pa.patch b/root/target/linux/brcm2708/patches-4.14/0299-net-lan78xx-Request-s-w-csum-check-on-VLAN-tagged-pa.patch new file mode 100644 index 00000000..bb308ce1 --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0299-net-lan78xx-Request-s-w-csum-check-on-VLAN-tagged-pa.patch @@ -0,0 +1,45 @@ +From fe7f40526989568c138d33d0e108afbb189ad4e2 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 9 Apr 2018 14:31:54 +0100 +Subject: [PATCH 299/299] net: lan78xx: Request s/w csum check on VLAN tagged + packets. + +There appears to be some issue in the LAN78xx where the checksum +computed on a VLAN tagged packet is incorrect, or at least not +in the form that the kernel is after. This is most easily shown +by pinging a device via a VLAN tagged interface and it will dump +out the error message and stack trace from netdev_rx_csum_fault. +It has also been seen with standard TCP and UDP packets. + +Until this is fully understood, request that the network stack +computes the checksum on packets signalled as having a VLAN tag +applied. + +See https://github.com/raspberrypi/linux/issues/2458 + +Signed-off-by: Dave Stevenson +--- + drivers/net/usb/lan78xx.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index e7cac41d6042..f11cff7664c3 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -2973,8 +2973,12 @@ static void lan78xx_rx_csum_offload(struct lan78xx_net *dev, + struct sk_buff *skb, + u32 rx_cmd_a, u32 rx_cmd_b) + { ++ /* Checksum offload appears to be flawed if used with VLANs. ++ * Elect for sw checksum check instead. ++ */ + if (!(dev->net->features & NETIF_F_RXCSUM) || +- unlikely(rx_cmd_a & RX_CMD_A_ICSM_)) { ++ unlikely(rx_cmd_a & RX_CMD_A_ICSM_) || ++ (rx_cmd_a & RX_CMD_A_FVTG_)) { + skb->ip_summed = CHECKSUM_NONE; + } else { + skb->csum = ntohs((u16)(rx_cmd_b >> RX_CMD_B_CSUM_SHIFT_)); +-- +2.16.1 +