From cab8ceeee1fea91c33df33bb6a6a73de4fb5eb21 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 7 Jul 2017 11:09:50 +0200 Subject: [PATCH] 3.18-stable patches added patches: bgmac-add-check-for-oversized-packets.patch bgmac-fix-device-initialization-on-northstar-socs-condition-typo.patch bgmac-reset-enable-ethernet-core-before-using-it.patch mips-uapi-ignore-__arch_swab-16-32-64-when-using-mips16.patch tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch usb-ehci-orion-fix-probe-for-generic_phy.patch --- ...gmac-add-check-for-oversized-packets.patch | 38 ++++++++++ ...ion-on-northstar-socs-condition-typo.patch | 46 ++++++++++++ ...enable-ethernet-core-before-using-it.patch | 40 ++++++++++ ...arch_swab-16-32-64-when-using-mips16.patch | 60 +++++++++++++++ queue-3.18/series | 6 ++ ...-a-module-name-starting-with-a-digit.patch | 74 +++++++++++++++++++ ...ehci-orion-fix-probe-for-generic_phy.patch | 43 +++++++++++ 7 files changed, 307 insertions(+) create mode 100644 queue-3.18/bgmac-add-check-for-oversized-packets.patch create mode 100644 queue-3.18/bgmac-fix-device-initialization-on-northstar-socs-condition-typo.patch create mode 100644 queue-3.18/bgmac-reset-enable-ethernet-core-before-using-it.patch create mode 100644 queue-3.18/mips-uapi-ignore-__arch_swab-16-32-64-when-using-mips16.patch create mode 100644 queue-3.18/tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch create mode 100644 queue-3.18/usb-ehci-orion-fix-probe-for-generic_phy.patch diff --git a/queue-3.18/bgmac-add-check-for-oversized-packets.patch b/queue-3.18/bgmac-add-check-for-oversized-packets.patch new file mode 100644 index 00000000000..69315afd1fb --- /dev/null +++ b/queue-3.18/bgmac-add-check-for-oversized-packets.patch @@ -0,0 +1,38 @@ +From 6a6c708469c9e10fd87adcc3abff164270538d62 Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Tue, 14 Apr 2015 12:07:58 +0200 +Subject: bgmac: add check for oversized packets + +From: Felix Fietkau + +commit 6a6c708469c9e10fd87adcc3abff164270538d62 upstream. + +In very rare cases, the MAC can catch an internal buffer that is bigger +than it's supposed to be. Instead of crashing the kernel, simply pass +the buffer back to the hardware + +Signed-off-by: Felix Fietkau +Signed-off-by: David S. Miller +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/broadcom/bgmac.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -373,6 +373,13 @@ static int bgmac_dma_rx_read(struct bgma + break; + } + ++ if (len > BGMAC_RX_ALLOC_SIZE) { ++ bgmac_err(bgmac, "Found oversized packet at slot %d, DMA issue!\n", ++ ring->start); ++ put_page(virt_to_head_page(buf)); ++ break; ++ } ++ + /* Omit CRC. */ + len -= ETH_FCS_LEN; + diff --git a/queue-3.18/bgmac-fix-device-initialization-on-northstar-socs-condition-typo.patch b/queue-3.18/bgmac-fix-device-initialization-on-northstar-socs-condition-typo.patch new file mode 100644 index 00000000000..e79cff217df --- /dev/null +++ b/queue-3.18/bgmac-fix-device-initialization-on-northstar-socs-condition-typo.patch @@ -0,0 +1,46 @@ +From 21697336d46b71dd031f29e426dda0b1e7f06cc0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Wed, 11 Feb 2015 18:06:34 +0100 +Subject: bgmac: fix device initialization on Northstar SoCs (condition typo) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +commit 21697336d46b71dd031f29e426dda0b1e7f06cc0 upstream. + +On Northstar (Broadcom's ARM architecture) we need to manually enable +all cores. Code for that is already in place, but the condition for it +was wrong. + +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/broadcom/bgmac.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1412,6 +1412,7 @@ static void bgmac_mii_unregister(struct + /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */ + static int bgmac_probe(struct bcma_device *core) + { ++ struct bcma_chipinfo *ci = &core->bus->chipinfo; + struct net_device *net_dev; + struct bgmac *bgmac; + struct ssb_sprom *sprom = &core->bus->sprom; +@@ -1474,8 +1475,8 @@ static int bgmac_probe(struct bcma_devic + bgmac_chip_reset(bgmac); + + /* For Northstar, we have to take all GMAC core out of reset */ +- if (core->id.id == BCMA_CHIP_ID_BCM4707 || +- core->id.id == BCMA_CHIP_ID_BCM53018) { ++ if (ci->id == BCMA_CHIP_ID_BCM4707 || ++ ci->id == BCMA_CHIP_ID_BCM53018) { + struct bcma_device *ns_core; + int ns_gmac; + diff --git a/queue-3.18/bgmac-reset-enable-ethernet-core-before-using-it.patch b/queue-3.18/bgmac-reset-enable-ethernet-core-before-using-it.patch new file mode 100644 index 00000000000..f3bf0227e2a --- /dev/null +++ b/queue-3.18/bgmac-reset-enable-ethernet-core-before-using-it.patch @@ -0,0 +1,40 @@ +From b4dfd8e92956b396d3438212bc9a0be6267b8b34 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 12 Apr 2016 13:30:45 +0200 +Subject: bgmac: reset & enable Ethernet core before using it +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +commit b4dfd8e92956b396d3438212bc9a0be6267b8b34 upstream. + +This fixes Ethernet on D-Link DIR-885L with BCM47094 SoC. Felix reported +similar fix was needed for his BCM4709 device (Buffalo WXR-1900DHP?). +I tested this for regressions on BCM4706, BCM4708A0 and BCM47081A0. + +Cc: Felix Fietkau +Signed-off-by: Rafał Miłecki +Signed-off-by: David S. Miller +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/broadcom/bgmac.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -1438,6 +1438,11 @@ static int bgmac_probe(struct bcma_devic + dev_warn(&core->dev, "Using random MAC: %pM\n", mac); + } + ++ /* This (reset &) enable is not preset in specs or reference driver but ++ * Broadcom does it in arch PCI code when enabling fake PCI device. ++ */ ++ bcma_core_enable(core, 0); ++ + /* Allocation and references */ + net_dev = alloc_etherdev(sizeof(*bgmac)); + if (!net_dev) diff --git a/queue-3.18/mips-uapi-ignore-__arch_swab-16-32-64-when-using-mips16.patch b/queue-3.18/mips-uapi-ignore-__arch_swab-16-32-64-when-using-mips16.patch new file mode 100644 index 00000000000..5103f897441 --- /dev/null +++ b/queue-3.18/mips-uapi-ignore-__arch_swab-16-32-64-when-using-mips16.patch @@ -0,0 +1,60 @@ +From 71a0a72456b48de972d7ed613b06a22a3aa9057f Mon Sep 17 00:00:00 2001 +From: Yousong Zhou +Date: Sat, 26 Sep 2015 13:41:43 +0800 +Subject: MIPS: UAPI: Ignore __arch_swab{16,32,64} when using MIPS16 + +From: Yousong Zhou + +commit 71a0a72456b48de972d7ed613b06a22a3aa9057f upstream. + +Some GCC versions (e.g. 4.8.3) can incorrectly inline a function with +MIPS32 instructions into another function with MIPS16 code [1], causing +the assembler to genereate incorrect binary code or fail right away +complaining about unrecognized opcode. + +In the case of __arch_swab{16,32}, when inlined by the compiler with +flags `-mips32r2 -mips16 -Os', the assembler can fail with the following +error. + + {standard input}:79: Error: unrecognized opcode `wsbh $2,$2' + +For performance concerns and to workaround the issue already existing in +older compilers, just ignore these 2 functions when compiling with +mips16 enabled. + + [1] Inlining nomips16 function into mips16 function can result in + undefined builtins, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55777 + +Signed-off-by: Yousong Zhou +Cc: Maciej W. Rozycki +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/11241/ +Signed-off-by: Ralf Baechle +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/include/uapi/asm/swab.h | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/arch/mips/include/uapi/asm/swab.h ++++ b/arch/mips/include/uapi/asm/swab.h +@@ -13,8 +13,9 @@ + + #define __SWAB_64_THRU_32__ + +-#if (defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ +- defined(_MIPS_ARCH_LOONGSON3A) ++#if !defined(__mips16) && \ ++ ((defined(__mips_isa_rev) && (__mips_isa_rev >= 2)) || \ ++ defined(_MIPS_ARCH_LOONGSON3A)) + + static inline __attribute_const__ __u16 __arch_swab16(__u16 x) + { +@@ -65,5 +66,5 @@ static inline __attribute_const__ __u64 + } + #define __arch_swab64 __arch_swab64 + #endif /* __mips64 */ +-#endif /* MIPS R2 or newer or Loongson 3A */ ++#endif /* (not __mips16) and (MIPS R2 or newer or Loongson 3A) */ + #endif /* _ASM_SWAB_H */ diff --git a/queue-3.18/series b/queue-3.18/series index 23dfa095227..f076c7e9b3b 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -1 +1,7 @@ driver-core-platform-fix-race-condition-with-driver_override.patch +mips-uapi-ignore-__arch_swab-16-32-64-when-using-mips16.patch +bgmac-fix-device-initialization-on-northstar-socs-condition-typo.patch +bgmac-add-check-for-oversized-packets.patch +bgmac-reset-enable-ethernet-core-before-using-it.patch +usb-ehci-orion-fix-probe-for-generic_phy.patch +tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch diff --git a/queue-3.18/tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch b/queue-3.18/tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch new file mode 100644 index 00000000000..fa816dca5f9 --- /dev/null +++ b/queue-3.18/tracing-kprobes-allow-to-create-probe-with-a-module-name-starting-with-a-digit.patch @@ -0,0 +1,74 @@ +From 9e52b32567126fe146f198971364f68d3bc5233f Mon Sep 17 00:00:00 2001 +From: Sabrina Dubroca +Date: Thu, 22 Jun 2017 11:24:42 +0200 +Subject: tracing/kprobes: Allow to create probe with a module name starting with a digit + +From: Sabrina Dubroca + +commit 9e52b32567126fe146f198971364f68d3bc5233f upstream. + +Always try to parse an address, since kstrtoul() will safely fail when +given a symbol as input. If that fails (which will be the case for a +symbol), try to parse a symbol instead. + +This allows creating a probe such as: + + p:probe/vlan_gro_receive 8021q:vlan_gro_receive+0 + +Which is necessary for this command to work: + + perf probe -m 8021q -a vlan_gro_receive + +Link: http://lkml.kernel.org/r/fd72d666f45b114e2c5b9cf7e27b91de1ec966f1.1498122881.git.sd@queasysnail.net + +Fixes: 413d37d1e ("tracing: Add kprobe-based event tracer") +Acked-by: Masami Hiramatsu +Signed-off-by: Sabrina Dubroca +Signed-off-by: Steven Rostedt (VMware) +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/trace/trace_kprobe.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +--- a/kernel/trace/trace_kprobe.c ++++ b/kernel/trace/trace_kprobe.c +@@ -671,30 +671,25 @@ static int create_trace_kprobe(int argc, + pr_info("Probe point is not specified.\n"); + return -EINVAL; + } +- if (isdigit(argv[1][0])) { +- if (is_return) { +- pr_info("Return probe point must be a symbol.\n"); +- return -EINVAL; +- } +- /* an address specified */ +- ret = kstrtoul(&argv[1][0], 0, (unsigned long *)&addr); +- if (ret) { +- pr_info("Failed to parse address.\n"); +- return ret; +- } +- } else { ++ ++ /* try to parse an address. if that fails, try to read the ++ * input as a symbol. */ ++ if (kstrtoul(argv[1], 0, (unsigned long *)&addr)) { + /* a symbol specified */ + symbol = argv[1]; + /* TODO: support .init module functions */ + ret = traceprobe_split_symbol_offset(symbol, &offset); + if (ret) { +- pr_info("Failed to parse symbol.\n"); ++ pr_info("Failed to parse either an address or a symbol.\n"); + return ret; + } + if (offset && is_return) { + pr_info("Return probe must be used without offset.\n"); + return -EINVAL; + } ++ } else if (is_return) { ++ pr_info("Return probe point must be a symbol.\n"); ++ return -EINVAL; + } + argc -= 2; argv += 2; + diff --git a/queue-3.18/usb-ehci-orion-fix-probe-for-generic_phy.patch b/queue-3.18/usb-ehci-orion-fix-probe-for-generic_phy.patch new file mode 100644 index 00000000000..8d8a49b9675 --- /dev/null +++ b/queue-3.18/usb-ehci-orion-fix-probe-for-generic_phy.patch @@ -0,0 +1,43 @@ +From db1319e166c5e872c4be54eac4e47454133708cf Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Sun, 23 Aug 2015 15:01:08 +0200 +Subject: usb: ehci-orion: fix probe for !GENERIC_PHY + +From: Jonas Gorski + +commit db1319e166c5e872c4be54eac4e47454133708cf upstream. + +Commit d445913ce0ab7f ("usb: ehci-orion: add optional PHY support") +added support for optional phys, but devm_phy_optional_get returns +-ENOSYS if GENERIC_PHY is not enabled. + +This causes probe failures, even when there are no phys specified: + +[ 1.443365] orion-ehci f1058000.usb: init f1058000.usb fail, -38 +[ 1.449403] orion-ehci: probe of f1058000.usb failed with error -38 + +Similar to dwc3, treat -ENOSYS as no phy. + +Fixes: d445913ce0ab7f ("usb: ehci-orion: add optional PHY support") + +Signed-off-by: Jonas Gorski +Acked-by: Alan Stern +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/host/ehci-orion.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/usb/host/ehci-orion.c ++++ b/drivers/usb/host/ehci-orion.c +@@ -226,7 +226,8 @@ static int ehci_orion_drv_probe(struct p + priv->phy = devm_phy_optional_get(&pdev->dev, "usb"); + if (IS_ERR(priv->phy)) { + err = PTR_ERR(priv->phy); +- goto err_phy_get; ++ if (err != -ENOSYS) ++ goto err_phy_get; + } else { + err = phy_init(priv->phy); + if (err) -- 2.47.3