From: Sasha Levin Date: Thu, 23 Feb 2023 02:42:43 +0000 (-0500) Subject: Fixes for 4.14 X-Git-Tag: v6.2.1~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e8bc324fc4f84d13115e8c690c4ac9c399f51661;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.14 Signed-off-by: Sasha Levin --- diff --git a/queue-4.14/netfilter-conntrack-fix-bug-in-for_each_sctp_chunk.patch b/queue-4.14/netfilter-conntrack-fix-bug-in-for_each_sctp_chunk.patch new file mode 100644 index 00000000000..ce6f037d4f1 --- /dev/null +++ b/queue-4.14/netfilter-conntrack-fix-bug-in-for_each_sctp_chunk.patch @@ -0,0 +1,42 @@ +From dae6a918ba118f0d180f0d71922b235a1cc16eb6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Jan 2023 02:47:19 +0100 +Subject: netfilter: conntrack: fix bug in for_each_sctp_chunk + +From: Sriram Yagnaraman + +[ Upstream commit 98ee0077452527f971567db01386de3c3d97ce13 ] + +skb_header_pointer() will return NULL if offset + sizeof(_sch) exceeds +skb->len, so this offset < skb->len test is redundant. + +if sch->length == 0, this will end up in an infinite loop, add a check +for sch->length > 0 + +Fixes: 9fb9cbb1082d ("[NETFILTER]: Add nf_conntrack subsystem.") +Suggested-by: Florian Westphal +Signed-off-by: Sriram Yagnaraman +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nf_conntrack_proto_sctp.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c +index 1278b27c625ab..cffd37f56c5c0 100644 +--- a/net/netfilter/nf_conntrack_proto_sctp.c ++++ b/net/netfilter/nf_conntrack_proto_sctp.c +@@ -184,8 +184,8 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) + + #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ + for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0; \ +- (offset) < (skb)->len && \ +- ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ ++ ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))) && \ ++ (sch)->length; \ + (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++) + + /* Some validity checks to make sure the chunks are fine */ +-- +2.39.0 + diff --git a/queue-4.14/powerpc-dts-t208x-disable-10g-on-mac1-and-mac2.patch b/queue-4.14/powerpc-dts-t208x-disable-10g-on-mac1-and-mac2.patch new file mode 100644 index 00000000000..061902872aa --- /dev/null +++ b/queue-4.14/powerpc-dts-t208x-disable-10g-on-mac1-and-mac2.patch @@ -0,0 +1,51 @@ +From 4872efa9e602ae7448bad57bb322e74e59d8c0c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 16 Dec 2022 12:29:37 -0500 +Subject: powerpc: dts: t208x: Disable 10G on MAC1 and MAC2 + +From: Sean Anderson + +[ Upstream commit 8d8bee13ae9e316443c6666286360126a19c8d94 ] + +There aren't enough resources to run these ports at 10G speeds. Disable +10G for these ports, reverting to the previous speed. + +Fixes: 36926a7d70c2 ("powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G") +Reported-by: Camelia Alexandra Groza +Signed-off-by: Sean Anderson +Reviewed-by: Camelia Groza +Tested-by: Camelia Groza +Link: https://lore.kernel.org/r/20221216172937.2960054-1-sean.anderson@seco.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +index a3cee1acd7abd..fda6c9213d9eb 100644 +--- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi ++++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +@@ -681,3 +681,19 @@ + interrupts = <16 2 1 9>; + }; + }; ++ ++&fman0_rx_0x08 { ++ /delete-property/ fsl,fman-10g-port; ++}; ++ ++&fman0_tx_0x28 { ++ /delete-property/ fsl,fman-10g-port; ++}; ++ ++&fman0_rx_0x09 { ++ /delete-property/ fsl,fman-10g-port; ++}; ++ ++&fman0_tx_0x29 { ++ /delete-property/ fsl,fman-10g-port; ++}; +-- +2.39.0 + diff --git a/queue-4.14/powerpc-dts-t208x-mark-mac1-and-mac2-as-10g.patch b/queue-4.14/powerpc-dts-t208x-mark-mac1-and-mac2-as-10g.patch new file mode 100644 index 00000000000..d5cdb437bb7 --- /dev/null +++ b/queue-4.14/powerpc-dts-t208x-mark-mac1-and-mac2-as-10g.patch @@ -0,0 +1,142 @@ +From 2e92114edba4f9b328c7f5decac38793542a0e7d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Oct 2022 16:22:39 -0400 +Subject: powerpc: dts: t208x: Mark MAC1 and MAC2 as 10G + +From: Sean Anderson + +[ Upstream commit 36926a7d70c2d462fca1ed85bfee000d17fd8662 ] + +On the T208X SoCs, MAC1 and MAC2 support XGMII. Add some new MAC dtsi +fragments, and mark the QMAN ports as 10G. + +Fixes: da414bb923d9 ("powerpc/mpc85xx: Add FSL QorIQ DPAA FMan support to the SoC device tree(s)") +Signed-off-by: Sean Anderson +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi | 44 +++++++++++++++++++ + .../boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi | 44 +++++++++++++++++++ + arch/powerpc/boot/dts/fsl/t2081si-post.dtsi | 4 +- + 3 files changed, 90 insertions(+), 2 deletions(-) + create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi + create mode 100644 arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi + +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi +new file mode 100644 +index 0000000000000..437dab3fc0176 +--- /dev/null ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-2.dtsi +@@ -0,0 +1,44 @@ ++// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later ++/* ++ * QorIQ FMan v3 10g port #2 device tree stub [ controller @ offset 0x400000 ] ++ * ++ * Copyright 2022 Sean Anderson ++ * Copyright 2012 - 2015 Freescale Semiconductor Inc. ++ */ ++ ++fman@400000 { ++ fman0_rx_0x08: port@88000 { ++ cell-index = <0x8>; ++ compatible = "fsl,fman-v3-port-rx"; ++ reg = <0x88000 0x1000>; ++ fsl,fman-10g-port; ++ }; ++ ++ fman0_tx_0x28: port@a8000 { ++ cell-index = <0x28>; ++ compatible = "fsl,fman-v3-port-tx"; ++ reg = <0xa8000 0x1000>; ++ fsl,fman-10g-port; ++ }; ++ ++ ethernet@e0000 { ++ cell-index = <0>; ++ compatible = "fsl,fman-memac"; ++ reg = <0xe0000 0x1000>; ++ fsl,fman-ports = <&fman0_rx_0x08 &fman0_tx_0x28>; ++ ptp-timer = <&ptp_timer0>; ++ pcsphy-handle = <&pcsphy0>; ++ }; ++ ++ mdio@e1000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; ++ reg = <0xe1000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ ++ ++ pcsphy0: ethernet-phy@0 { ++ reg = <0x0>; ++ }; ++ }; ++}; +diff --git a/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi +new file mode 100644 +index 0000000000000..ad116b17850a8 +--- /dev/null ++++ b/arch/powerpc/boot/dts/fsl/qoriq-fman3-0-10g-3.dtsi +@@ -0,0 +1,44 @@ ++// SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-or-later ++/* ++ * QorIQ FMan v3 10g port #3 device tree stub [ controller @ offset 0x400000 ] ++ * ++ * Copyright 2022 Sean Anderson ++ * Copyright 2012 - 2015 Freescale Semiconductor Inc. ++ */ ++ ++fman@400000 { ++ fman0_rx_0x09: port@89000 { ++ cell-index = <0x9>; ++ compatible = "fsl,fman-v3-port-rx"; ++ reg = <0x89000 0x1000>; ++ fsl,fman-10g-port; ++ }; ++ ++ fman0_tx_0x29: port@a9000 { ++ cell-index = <0x29>; ++ compatible = "fsl,fman-v3-port-tx"; ++ reg = <0xa9000 0x1000>; ++ fsl,fman-10g-port; ++ }; ++ ++ ethernet@e2000 { ++ cell-index = <1>; ++ compatible = "fsl,fman-memac"; ++ reg = <0xe2000 0x1000>; ++ fsl,fman-ports = <&fman0_rx_0x09 &fman0_tx_0x29>; ++ ptp-timer = <&ptp_timer0>; ++ pcsphy-handle = <&pcsphy1>; ++ }; ++ ++ mdio@e3000 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "fsl,fman-memac-mdio", "fsl,fman-xmdio"; ++ reg = <0xe3000 0x1000>; ++ fsl,erratum-a011043; /* must ignore read errors */ ++ ++ pcsphy1: ethernet-phy@0 { ++ reg = <0x0>; ++ }; ++ }; ++}; +diff --git a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +index a97296c64eb22..a3cee1acd7abd 100644 +--- a/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi ++++ b/arch/powerpc/boot/dts/fsl/t2081si-post.dtsi +@@ -631,8 +631,8 @@ + /include/ "qoriq-bman1.dtsi" + + /include/ "qoriq-fman3-0.dtsi" +-/include/ "qoriq-fman3-0-1g-0.dtsi" +-/include/ "qoriq-fman3-0-1g-1.dtsi" ++/include/ "qoriq-fman3-0-10g-2.dtsi" ++/include/ "qoriq-fman3-0-10g-3.dtsi" + /include/ "qoriq-fman3-0-1g-2.dtsi" + /include/ "qoriq-fman3-0-1g-3.dtsi" + /include/ "qoriq-fman3-0-1g-4.dtsi" +-- +2.39.0 + diff --git a/queue-4.14/random-always-mix-cycle-counter-in-add_latent_entrop.patch b/queue-4.14/random-always-mix-cycle-counter-in-add_latent_entrop.patch new file mode 100644 index 00000000000..ae8dfcd4895 --- /dev/null +++ b/queue-4.14/random-always-mix-cycle-counter-in-add_latent_entrop.patch @@ -0,0 +1,61 @@ +From c4bc17f3bdf724052441785ba8d7bee6178ccb97 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Jun 2022 22:45:33 +0200 +Subject: random: always mix cycle counter in add_latent_entropy() + +From: Jason A. Donenfeld + +[ Upstream commit d7bf7f3b813e3755226bcb5114ad2ac477514ebf ] + +add_latent_entropy() is called every time a process forks, in +kernel_clone(). This in turn calls add_device_randomness() using the +latent entropy global state. add_device_randomness() does two things: + + 2) Mixes into the input pool the latent entropy argument passed; and + 1) Mixes in a cycle counter, a sort of measurement of when the event + took place, the high precision bits of which are presumably + difficult to predict. + +(2) is impossible without CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y. But (1) is +always possible. However, currently CONFIG_GCC_PLUGIN_LATENT_ENTROPY=n +disables both (1) and (2), instead of just (2). + +This commit causes the CONFIG_GCC_PLUGIN_LATENT_ENTROPY=n case to still +do (1) by passing NULL (len 0) to add_device_randomness() when add_latent_ +entropy() is called. + +Cc: Dominik Brodowski +Cc: PaX Team +Cc: Emese Revfy +Fixes: 38addce8b600 ("gcc-plugins: Add latent_entropy plugin") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Sasha Levin +--- + include/linux/random.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/linux/random.h b/include/linux/random.h +index 3feafab498ad9..ed75fb2b0ca94 100644 +--- a/include/linux/random.h ++++ b/include/linux/random.h +@@ -19,14 +19,14 @@ void add_input_randomness(unsigned int type, unsigned int code, + void add_interrupt_randomness(int irq) __latent_entropy; + void add_hwgenerator_randomness(const void *buf, size_t len, size_t entropy); + +-#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) + static inline void add_latent_entropy(void) + { ++#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) + add_device_randomness((const void *)&latent_entropy, sizeof(latent_entropy)); +-} + #else +-static inline void add_latent_entropy(void) { } ++ add_device_randomness(NULL, 0); + #endif ++} + + void get_random_bytes(void *buf, size_t len); + size_t __must_check get_random_bytes_arch(void *buf, size_t len); +-- +2.39.0 + diff --git a/queue-4.14/revert-netfilter-conntrack-fix-bug-in-for_each_sctp_.patch b/queue-4.14/revert-netfilter-conntrack-fix-bug-in-for_each_sctp_.patch new file mode 100644 index 00000000000..021cc4aa710 --- /dev/null +++ b/queue-4.14/revert-netfilter-conntrack-fix-bug-in-for_each_sctp_.patch @@ -0,0 +1,44 @@ +From 0e7528b091ccdcf79892af732c349830c6d78d7d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Jan 2023 02:35:21 +0100 +Subject: Revert "netfilter: conntrack: fix bug in for_each_sctp_chunk" + +From: Florian Westphal + +[ Upstream commit bd0e06f0def75ba26572a94e5350324474a55562 ] + +There is no bug. If sch->length == 0, this would result in an infinite +loop, but first caller, do_basic_checks(), errors out in this case. + +After this change, packets with bogus zero-length chunks are no longer +detected as invalid, so revert & add comment wrt. 0 length check. + +Fixes: 98ee00774525 ("netfilter: conntrack: fix bug in for_each_sctp_chunk") +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nf_conntrack_proto_sctp.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/net/netfilter/nf_conntrack_proto_sctp.c b/net/netfilter/nf_conntrack_proto_sctp.c +index cffd37f56c5c0..6166c2012e0d8 100644 +--- a/net/netfilter/nf_conntrack_proto_sctp.c ++++ b/net/netfilter/nf_conntrack_proto_sctp.c +@@ -182,10 +182,11 @@ static void sctp_print_conntrack(struct seq_file *s, struct nf_conn *ct) + } + #endif + ++/* do_basic_checks ensures sch->length > 0, do not use before */ + #define for_each_sctp_chunk(skb, sch, _sch, offset, dataoff, count) \ + for ((offset) = (dataoff) + sizeof(struct sctphdr), (count) = 0; \ +- ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))) && \ +- (sch)->length; \ ++ (offset) < (skb)->len && \ ++ ((sch) = skb_header_pointer((skb), (offset), sizeof(_sch), &(_sch))); \ + (offset) += (ntohs((sch)->length) + 3) & ~3, (count)++) + + /* Some validity checks to make sure the chunks are fine */ +-- +2.39.0 + diff --git a/queue-4.14/series b/queue-4.14/series new file mode 100644 index 00000000000..d59c12c24b8 --- /dev/null +++ b/queue-4.14/series @@ -0,0 +1,6 @@ +wifi-rtl8xxxu-gen2-turn-on-the-rate-control.patch +powerpc-dts-t208x-mark-mac1-and-mac2-as-10g.patch +random-always-mix-cycle-counter-in-add_latent_entrop.patch +powerpc-dts-t208x-disable-10g-on-mac1-and-mac2.patch +netfilter-conntrack-fix-bug-in-for_each_sctp_chunk.patch +revert-netfilter-conntrack-fix-bug-in-for_each_sctp_.patch diff --git a/queue-4.14/wifi-rtl8xxxu-gen2-turn-on-the-rate-control.patch b/queue-4.14/wifi-rtl8xxxu-gen2-turn-on-the-rate-control.patch new file mode 100644 index 00000000000..da100ed9e1e --- /dev/null +++ b/queue-4.14/wifi-rtl8xxxu-gen2-turn-on-the-rate-control.patch @@ -0,0 +1,69 @@ +From fe71ddaaed293d0ef5454d9de91ab653139d9262 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Sep 2022 23:36:51 +0300 +Subject: wifi: rtl8xxxu: gen2: Turn on the rate control + +From: Bitterblue Smith + +[ Upstream commit 791082ec0ab843e0be07c8ce3678e4c2afd2e33d ] + +Re-enable the function rtl8xxxu_gen2_report_connect. + +It informs the firmware when connecting to a network. This makes the +firmware enable the rate control, which makes the upload faster. + +It also informs the firmware when disconnecting from a network. In the +past this made reconnecting impossible because it was sending the +auth on queue 0x7 (TXDESC_QUEUE_VO) instead of queue 0x12 +(TXDESC_QUEUE_MGNT): + +wlp0s20f0u3: send auth to 90:55:de:__:__:__ (try 1/3) +wlp0s20f0u3: send auth to 90:55:de:__:__:__ (try 2/3) +wlp0s20f0u3: send auth to 90:55:de:__:__:__ (try 3/3) +wlp0s20f0u3: authentication with 90:55:de:__:__:__ timed out + +Probably the firmware disables the unnecessary TX queues when it +knows it's disconnected. + +However, this was fixed in commit edd5747aa12e ("wifi: rtl8xxxu: Fix +skb misuse in TX queue selection"). + +Fixes: c59f13bbead4 ("rtl8xxxu: Work around issue with 8192eu and 8723bu devices not reconnecting") +Signed-off-by: Bitterblue Smith +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/43200afc-0c65-ee72-48f8-231edd1df493@gmail.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +index a287c28b38b5d..f7c879a7a1be3 100644 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +@@ -4375,12 +4375,9 @@ void rtl8xxxu_gen1_report_connect(struct rtl8xxxu_priv *priv, + void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, + u8 macid, bool connect) + { +-#ifdef RTL8XXXU_GEN2_REPORT_CONNECT + /* +- * Barry Day reports this causes issues with 8192eu and 8723bu +- * devices reconnecting. The reason for this is unclear, but +- * until it is better understood, leave the code in place but +- * disabled, so it is not lost. ++ * The firmware turns on the rate control when it knows it's ++ * connected to a network. + */ + struct h2c_cmd h2c; + +@@ -4393,7 +4390,6 @@ void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv, + h2c.media_status_rpt.parm &= ~BIT(0); + + rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt)); +-#endif + } + + void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv) +-- +2.39.0 +