6.13.2-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 128/623 cpufreq: qcom: Implement clk_ops::determine_rate() for qcom_cpufreq* clocks
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
[ Upstream commit a9ba290d0b829012574b6821ba08815046e60c94 ]
determine_rate() callback is used by the clk_set_rate() API to get the closest rate of the target rate supported by the clock. If this callback is not implemented (nor round_rate() callback), then the API will assume that the clock cannot set the requested rate. And since there is no parent, it will return -EINVAL.
This is not an issue right now as clk_set_rate() mistakenly compares the target rate with cached rate and bails out early. But once that is fixed to compare the target rate with the actual rate of the clock (returned by recalc_rate()), then clk_set_rate() for this clock will start to fail as below:
cpu cpu0: _opp_config_clk_single: failed to set clock rate: -22
So implement the determine_rate() callback that just returns the actual rate at which the clock is passed to the CPUs in a domain.
--- drivers/cpufreq/qcom-cpufreq-hw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/cpufreq/qcom-cpufreq-hw.c +13 -0
@@ -626,8 +626,21 @@ static unsigned long qcom_cpufreq_hw_recalc_rate(struct clk_hw *hw, unsigned lonreturn __qcom_cpufreq_hw_get (data->policy) *HZ_PER_KHZ ; } +/* +* Since we cannot determine the closest rate of the target rate, let's just +* return the actual rate at which the clock is running at. This is needed to +* make clk_set_rate() API work properly. +*/ +static int qcom_cpufreq_hw_determine_rate (struct clk_hw *hw,struct clk_rate_request *req) +{ + req->rate =qcom_cpufreq_hw_recalc_rate (hw,0 ); + +return 0 ; +} +static const struct clk_ops qcom_cpufreq_hw_clk_ops = { .recalc_rate = qcom_cpufreq_hw_recalc_rate, + .determine_rate = qcom_cpufreq_hw_determine_rate, };static int qcom_cpufreq_hw_driver_probe (struct platform_device *pdev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 129/623 udp: Deal with race between UDP socket address change and rehash
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Brivio <[email protected]>
[ Upstream commit a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c ]
If a UDP socket changes its local address while it's receiving datagrams, as a result of connect(), there is a period during which a lookup operation might fail to find it, after the address is changed but before the secondary hash (port and address) and the four-tuple hash (local and remote ports and addresses) are updated.
Secondary hash chains were introduced by commit 30fff9231fad ("udp:bind() optimisation") and, as a result, a rehash operation became needed to make a bound socket reachable again after a connect().
This operation was introduced by commit 719f835853a9 ("udp: add rehash on connect()") which isn't however a complete fix: the socket will be found once the rehashing completes, but not while it's pending.
This is noticeable with a socat(1) server in UDP4-LISTEN mode, and a client sending datagrams to it. After the server receives the first datagram (cf. _xioopen_ipdgram_listen()), it issues a connect() to the address of the sender, in order to set up a directed flow.
Now, if the client, running on a different CPU thread, happens to send a (subsequent) datagram while the server's socket changes its address, but is not rehashed yet, this will result in a failed lookup and a port unreachable error delivered to the client, as apparent from the following reproducer:
LEN=$(($(cat /proc/sys/net/core/wmem_default) / 4))
dd if=/dev/urandom bs=1 count=${LEN} of=tmp.in
while :; do
taskset -c 1 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc &
sleep 0.1 || sleep 1
taskset -c 2 socat OPEN:tmp.in UDP4:localhost:1337,shut-null
wait
donewhere the client will eventually get ECONNREFUSED on a write() (typically the second or third one of a given iteration):
2024/11/13 21:28:23 socat[46901] E write(6, 0x556db2e3c000, 8192): Connection refused
This issue was first observed as a seldom failure in Podman's tests checking UDP functionality while using pasta(1) to connect the container's network namespace, which leads us to a reproducer with the lookup error resulting in an ICMP packet on a tap device:
LOCAL_ADDR="$(ip -j -4 addr show|jq -rM '.[] | .addr_info[0] | select(.scope == "global").local')"
while :; do
./pasta --config-net -p pasta.pcap -u 1337 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc &
sleep 0.2 || sleep 1
socat OPEN:tmp.in UDP4:${LOCAL_ADDR}:1337,shut-null
wait
cmp tmp.in tmp.out
doneOnce this fails:
tmp.in tmp.out differ: char 8193, line 29
we can finally have a look at what's going on:
$ tshark -r pasta.pcap
1 0.000000 :: ? ff02::16 ICMPv6 110 Multicast Listener Report Message v2
2 0.168690 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
3 0.168767 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
4 0.168806 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
5 0.168827 c6:47:05:8d:dc:04 ? Broadcast ARP 42 Who has 88.198.0.161? Tell 88.198.0.164
6 0.168851 9a:55:9a:55:9a:55 ? c6:47:05:8d:dc:04 ARP 42 88.198.0.161 is at 9a:55:9a:55:9a:55
7 0.168875 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
8 0.168896 88.198.0.164 ? 88.198.0.161 ICMP 590 Destination unreachable (Port unreachable)
9 0.168926 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
10 0.168959 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192
11 0.168989 88.198.0.161 ? 88.198.0.164 UDP 4138 60260 ? 1337 Len=4096
12 0.169010 88.198.0.161 ? 88.198.0.164 UDP 42 60260 ? 1337 Len=0On the third datagram received, the network namespace of the container initiates an ARP lookup to deliver the ICMP message.
In another variant of this reproducer, starting the client with:
strace -f pasta --config-net -u 1337 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc 2>strace.log &
and connecting to the socat server using a loopback address:
socat OPEN:tmp.in UDP4:localhost:1337,shut-null
we can more clearly observe a sendmmsg() call failing after the first datagram is delivered:
[pid 278012] connect(173, 0x7fff96c95fc0, 16) = 0
[...]
[pid 278012] recvmmsg(173, 0x7fff96c96020, 1024, MSG_DONTWAIT, NULL) = -1 EAGAIN (Resource temporarily unavailable) [pid 278012] sendmmsg(173, 0x561c5ad0a720, 1, MSG_NOSIGNAL) = 1
[...]
[pid 278012] sendmmsg(173, 0x561c5ad0a720, 1, MSG_NOSIGNAL) = -1 ECONNREFUSED (Connection refused)
and, somewhat confusingly, after a connect() on the same socket succeeded.
Until commit 4cdeeee9252a ("net: udp: prefer listeners bound to an address"), the race between receive address change and lookup didn't actually cause visible issues, because, once the lookup based on the secondary hash chain failed, we would still attempt a lookup based on the primary hash (destination port only), and find the socket with the outdated secondary hash.
That change, however, dropped port-only lookups altogether, as side effect, making the race visible.
To fix this, while avoiding the need to make address changes and rehash atomic against lookups, reintroduce primary hash lookups as fallback, if lookups based on four-tuple and secondary hashes fail.
To this end, introduce a simplified lookup implementation, which doesn't take care of SO_REUSEPORT groups: if we have one, there are multiple sockets that would match the four-tuple or secondary hash, meaning that we can't run into this race at all.
v2:
- instead of synchronising lookup operations against address change plus rehash, reintroduce a simplified version of the original primary hash lookup as fallback
v1:
- fix build with CONFIG_IPV6=n: add ifdef around sk_v6_rcv_saddr usage (Kuniyuki Iwashima)
- directly use sk_rcv_saddr for IPv4 receive addresses instead of fetching inet_rcv_saddr (Kuniyuki Iwashima)
- move inet_update_saddr() to inet_hashtables.h and use that to set IPv4/IPv6 addresses as suitable (Kuniyuki Iwashima)
- rebase onto net-next, update commit message accordingly
--- net/ipv4/udp.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ net/ipv6/udp.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+)
net/ipv4/udp.c +56 -0
@@ -420,6 +420,49 @@ u32 udp_ehashfn(const struct net *net, const __be32 laddr, const __u16 lport, }EXPORT_SYMBOL (udp_ehashfn); +/** +* udp4_lib_lookup1() - Simplified lookup using primary hash (destination port) +* @net: Network namespace +* @saddr: Source address, network order +* @sport: Source port, network order +* @daddr: Destination address, network order +* @hnum: Destination port, host order +* @dif: Destination interface index +* @sdif: Destination bridge port index, if relevant +* @udptable: Set of UDP hash tables +* +* Simplified lookup to be used as fallback if no sockets are found due to a +* potential race between (receive) address change, and lookup happening before +* the rehash operation. This function ignores SO_REUSEPORT groups while scoring +* result sockets, because if we have one, we don't need the fallback at all. +* +* Called under rcu_read_lock(). +* +* Return: socket with highest matching score if any, NULL if none +*/ +static struct sock *udp4_lib_lookup1 (const struct net *net, +__be32 saddr,__be16 sport, +__be32 daddr,unsigned int hnum, +int dif,int sdif, +const struct udp_table *udptable) +{ +unsigned int slot =udp_hashfn (net, hnum, udptable->mask); +struct udp_hslot *hslot = &udptable->hash[slot]; +struct sock *sk, *result =NULL ; +int score, badness =0 ; + +sk_for_each_rcu (sk, &hslot->head) { + score =compute_score (sk, net, + saddr, sport, daddr, hnum, dif, sdif); +if (score > badness) { + result = sk; + badness = score; + } + } + +return result; +} +/* called with rcu_read_lock() */ static struct sock *udp4_lib_lookup2(const struct net *net, __be32 saddr, __be16 sport,
@@ -681,6 +724,19 @@ struct sock *__udp4_lib_lookup(const struct net *net, __be32 saddr, result =udp4_lib_lookup2 (net, saddr, sport,htonl (INADDR_ANY ), hnum, dif, sdif, hslot2, skb); +if (!IS_ERR_OR_NULL (result)) + goto done; + +/* Primary hash (destination port) lookup as fallback for this race: +* 1. __ip4_datagram_connect() sets sk_rcv_saddr +* 2. lookup (this function): new sk_rcv_saddr, hashes not updated yet +* 3. rehash operation updating _secondary and four-tuple_ hashes +* The primary hash doesn't need an update after 1., so, thanks to this +* further step, 1. and 3. don't need to be atomic against the lookup. +*/ + result =udp4_lib_lookup1 (net, saddr, sport, daddr, hnum, dif, sdif, + udptable); + done:if (IS_ERR (result))return NULL ;
net/ipv6/udp.c +50 -0
62 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 130/623 clk: imx8mp: Fix clkout1/2 support
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit a9b7c84d22fb1687d63ca2a386773015cf59436b ]
The CLKOUTn may be fed from PLL1/2/3, but the PLL1/2/3 has to be enabled first by setting PLL_CLKE bit 11 in CCM_ANALOG_SYS_PLLn_GEN_CTRL register. The CCM_ANALOG_SYS_PLLn_GEN_CTRL bit 11 is modeled by plln_out clock. Fix the clock tree and place the clkout1/2 under plln_sel instead of plain plln to let the clock subsystem correctly control the bit 11 and enable the PLL in case the CLKOUTn is supplied by PLL1/2/3.
--- drivers/clk/imx/clk-imx8mp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-imx8mp.c +3 -2
@@ -399,8 +399,9 @@ static const char * const imx8mp_dram_core_sels[] = {"dram_pll_out", "dram_alt_rstatic const char *const imx8mp_clkout_sels[] = {"audio_pll1_out" ,"audio_pll2_out" ,"video_pll1_out" ,"dummy" ,"dummy" ,"gpu_pll_out" ,"vpu_pll_out" , -"arm_pll_out" ,"sys_pll1" ,"sys_pll2" ,"sys_pll3" , -"dummy" ,"dummy" ,"osc_24m" ,"dummy" ,"osc_32k" }; +"arm_pll_out" ,"sys_pll1_out" ,"sys_pll2_out" , +"sys_pll3_out" ,"dummy" ,"dummy" ,"osc_24m" , +"dummy" ,"osc_32k" };static struct clk_hw **hws;static struct clk_hw_onecell_data *clk_hw_data;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 131/623 dt-bindings: clock: imx93: Add SPDIF IPG clk
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 32e9dea2645fa10dfa08b4e333918affaf1e4de5 ]
Add SPDIF IPG clk. The SPDIF IPG clock and root clock share same clock gate.
--- include/dt-bindings/clock/imx93-clock.h | 1 + 1 file changed, 1 insertion(+)
include/dt-bindings/clock/imx93-clock.h +1 -0
@@ -209,5 +209,6 @@#define IMX91_CLK_ENET2_REGULAR 204#define IMX91_CLK_ENET2_REGULAR_GATE 205#define IMX91_CLK_ENET1_QOS_TSN_GATE 206 +#define IMX93_CLK_SPDIF_IPG 207#endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 132/623 clk: imx93: Add IMX93_CLK_SPDIF_IPG clock
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 6a7853544482e2336b5b8bb9a4b964f9d687f290 ]
Split IMX93_CLK_SPDIF_IPG from IMX93_CLK_SPDIF_GATE because the IMX93_CLK_SPDIF_GATE controls the gate of IPG clock and root clock. Without this change, disabling IMX93_CLK_SPDIF_GATE would also disable the IPG clock, causing register access failures.
--- drivers/clk/imx/clk-imx93.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/imx/clk-imx93.c +4 -2
@@ -15,7 +15,7 @@#include "clk.h" -#define IMX93_CLK_END 207 +#define IMX93_CLK_END 208#define PLAT_IMX93 BIT(0)#define PLAT_IMX91 BIT(1)
@@ -38,6 +38,7 @@ static u32 share_count_sai2;static u32 share_count_sai3;static u32 share_count_mub;static u32 share_count_pdm; +static u32 share_count_spdif;static const char *const a55_core_sels[] = {"a55_alt" ,"arm_pll" };static const char *parent_names[MAX_SEL ][4 ] = {
@@ -252,7 +253,8 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_MQS1_GATE, "mqs1", "sai1_root", 0x9b00, }, { IMX93_CLK_MQS2_GATE, "mqs2", "sai3_root", 0x9b40, }, { IMX93_CLK_AUD_XCVR_GATE, "aud_xcvr", "audio_xcvr_root", 0x9b80, }, - { IMX93_CLK_SPDIF_GATE, "spdif", "spdif_root", 0x9c00, }, + { IMX93_CLK_SPDIF_IPG, "spdif_ipg_clk", "bus_wakeup_root", 0x9c00, 0, &share_count_spdif}, + { IMX93_CLK_SPDIF_GATE, "spdif", "spdif_root", 0x9c00, 0, &share_count_spdif}, { IMX93_CLK_HSIO_32K_GATE, "hsio_32k", "osc_32k", 0x9dc0, }, { IMX93_CLK_ENET1_GATE, "enet1", "wakeup_axi_root", 0x9e00, 0, NULL, PLAT_IMX93, }, { IMX93_CLK_ENET_QOS_GATE, "enet_qos", "wakeup_axi_root", 0x9e40, 0, NULL, PLAT_IMX93, },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 133/623 arm64: dts: imx93: Use IMX93_CLK_SPDIF_IPG as SPDIF IPG clock
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shengjiu Wang <[email protected]>
[ Upstream commit 570b890e66334f283710af36feb2115f16c7a27c ]
IMX93_CLK_BUS_WAKEUP is not accurate IPG clock, which missed the clock gate part.
IMX93_CLK_SPDIF_IPG is the correct clock.
--- arch/arm64/boot/dts/freescale/imx93.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx93.dtsi +1 -1
@@ -925,7 +925,7 @@ reg-names = "ram", "regs", "rxfifo", "txfifo"; interrupts = <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH>, <GIC_SPI 204 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk IMX93_CLK_BUS_WAKEUP>, + clocks = <&clk IMX93_CLK_SPDIF_IPG>, <&clk IMX93_CLK_SPDIF_GATE>, <&clk IMX93_CLK_DUMMY>, <&clk IMX93_CLK_AUD_XCVR_GATE>;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 134/623 clk: imx: Apply some clks only for i.MX93
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
[ Upstream commit 48806be086360846bb308c5ee21fcab8405a3da7 ]
Enable the LVDS gate, MIPI DSI, PXP, FLEXIO and MU only for i.MX93, because i.MX91 does not support them.
Update enet clk entry format to align with others.
--- drivers/clk/imx/clk-imx93.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/clk/imx/clk-imx93.c +13 -13
@@ -71,8 +71,8 @@ static const struct imx93_clk_root { { IMX93_CLK_WAKEUP_AXI, "wakeup_axi_root", 0x0380, FAST_SEL, CLK_IS_CRITICAL }, { IMX93_CLK_SWO_TRACE, "swo_trace_root", 0x0400, LOW_SPEED_IO_SEL, }, { IMX93_CLK_M33_SYSTICK, "m33_systick_root", 0x0480, LOW_SPEED_IO_SEL, 0, PLAT_IMX93, }, - { IMX93_CLK_FLEXIO1, "flexio1_root", 0x0500, LOW_SPEED_IO_SEL, }, - { IMX93_CLK_FLEXIO2, "flexio2_root", 0x0580, LOW_SPEED_IO_SEL, }, + { IMX93_CLK_FLEXIO1, "flexio1_root", 0x0500, LOW_SPEED_IO_SEL, 0, PLAT_IMX93, }, + { IMX93_CLK_FLEXIO2, "flexio2_root", 0x0580, LOW_SPEED_IO_SEL, 0, PLAT_IMX93, }, { IMX93_CLK_LPTMR1, "lptmr1_root", 0x0700, LOW_SPEED_IO_SEL, }, { IMX93_CLK_LPTMR2, "lptmr2_root", 0x0780, LOW_SPEED_IO_SEL, }, { IMX93_CLK_TPM2, "tpm2_root", 0x0880, TPM_SEL, },
@@ -178,10 +178,10 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_WDOG5_GATE, "wdog5", "osc_24m", 0x8400, }, { IMX93_CLK_SEMA1_GATE, "sema1", "bus_aon_root", 0x8440, }, { IMX93_CLK_SEMA2_GATE, "sema2", "bus_wakeup_root", 0x8480, }, - { IMX93_CLK_MU1_A_GATE, "mu1_a", "bus_aon_root", 0x84c0, CLK_IGNORE_UNUSED }, - { IMX93_CLK_MU2_A_GATE, "mu2_a", "bus_wakeup_root", 0x84c0, CLK_IGNORE_UNUSED }, - { IMX93_CLK_MU1_B_GATE, "mu1_b", "bus_aon_root", 0x8500, 0, &share_count_mub }, - { IMX93_CLK_MU2_B_GATE, "mu2_b", "bus_wakeup_root", 0x8500, 0, &share_count_mub }, + { IMX93_CLK_MU1_A_GATE, "mu1_a", "bus_aon_root", 0x84c0, CLK_IGNORE_UNUSED, NULL, PLAT_IMX93 }, + { IMX93_CLK_MU2_A_GATE, "mu2_a", "bus_wakeup_root", 0x84c0, CLK_IGNORE_UNUSED, NULL, PLAT_IMX93 }, + { IMX93_CLK_MU1_B_GATE, "mu1_b", "bus_aon_root", 0x8500, 0, &share_count_mub, PLAT_IMX93 }, + { IMX93_CLK_MU2_B_GATE, "mu2_b", "bus_wakeup_root", 0x8500, 0, &share_count_mub, PLAT_IMX93 }, { IMX93_CLK_EDMA1_GATE, "edma1", "m33_root", 0x8540, }, { IMX93_CLK_EDMA2_GATE, "edma2", "wakeup_axi_root", 0x8580, }, { IMX93_CLK_FLEXSPI1_GATE, "flexspi1", "flexspi1_root", 0x8640, },
@@ -189,8 +189,8 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_GPIO2_GATE, "gpio2", "bus_wakeup_root", 0x88c0, }, { IMX93_CLK_GPIO3_GATE, "gpio3", "bus_wakeup_root", 0x8900, }, { IMX93_CLK_GPIO4_GATE, "gpio4", "bus_wakeup_root", 0x8940, }, - { IMX93_CLK_FLEXIO1_GATE, "flexio1", "flexio1_root", 0x8980, }, - { IMX93_CLK_FLEXIO2_GATE, "flexio2", "flexio2_root", 0x89c0, }, + { IMX93_CLK_FLEXIO1_GATE, "flexio1", "flexio1_root", 0x8980, 0, NULL, PLAT_IMX93}, + { IMX93_CLK_FLEXIO2_GATE, "flexio2", "flexio2_root", 0x89c0, 0, NULL, PLAT_IMX93}, { IMX93_CLK_LPIT1_GATE, "lpit1", "bus_aon_root", 0x8a00, }, { IMX93_CLK_LPIT2_GATE, "lpit2", "bus_wakeup_root", 0x8a40, }, { IMX93_CLK_LPTMR1_GATE, "lptmr1", "lptmr1_root", 0x8a80, },
@@ -239,10 +239,10 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_SAI3_GATE, "sai3", "sai3_root", 0x94c0, 0, &share_count_sai3}, { IMX93_CLK_SAI3_IPG, "sai3_ipg_clk", "bus_wakeup_root", 0x94c0, 0, &share_count_sai3}, { IMX93_CLK_MIPI_CSI_GATE, "mipi_csi", "media_apb_root", 0x9580, }, - { IMX93_CLK_MIPI_DSI_GATE, "mipi_dsi", "media_apb_root", 0x95c0, }, - { IMX93_CLK_LVDS_GATE, "lvds", "media_ldb_root", 0x9600, }, + { IMX93_CLK_MIPI_DSI_GATE, "mipi_dsi", "media_apb_root", 0x95c0, 0, NULL, PLAT_IMX93 }, + { IMX93_CLK_LVDS_GATE, "lvds", "media_ldb_root", 0x9600, 0, NULL, PLAT_IMX93 }, { IMX93_CLK_LCDIF_GATE, "lcdif", "media_apb_root", 0x9640, }, - { IMX93_CLK_PXP_GATE, "pxp", "media_apb_root", 0x9680, }, + { IMX93_CLK_PXP_GATE, "pxp", "media_apb_root", 0x9680, 0, NULL, PLAT_IMX93 }, { IMX93_CLK_ISI_GATE, "isi", "media_apb_root", 0x96c0, }, { IMX93_CLK_NIC_MEDIA_GATE, "nic_media", "media_axi_root", 0x9700, }, { IMX93_CLK_USB_CONTROLLER_GATE, "usb_controller", "hsio_root", 0x9a00, },
@@ -258,8 +258,8 @@ static const struct imx93_clk_ccgr { { IMX93_CLK_HSIO_32K_GATE, "hsio_32k", "osc_32k", 0x9dc0, }, { IMX93_CLK_ENET1_GATE, "enet1", "wakeup_axi_root", 0x9e00, 0, NULL, PLAT_IMX93, }, { IMX93_CLK_ENET_QOS_GATE, "enet_qos", "wakeup_axi_root", 0x9e40, 0, NULL, PLAT_IMX93, }, - { IMX91_CLK_ENET2_REGULAR_GATE, "enet2_regular", "wakeup_axi_root", 0x9e00, 0, NULL, PLAT_IMX91, }, - { IMX91_CLK_ENET1_QOS_TSN_GATE, "enet1_qos_tsn", "wakeup_axi_root", 0x9e40, 0, NULL, PLAT_IMX91, }, + { IMX91_CLK_ENET2_REGULAR_GATE, "enet2_regular", "wakeup_axi_root", 0x9e00, 0, NULL, PLAT_IMX91, }, + { IMX91_CLK_ENET1_QOS_TSN_GATE, "enet1_qos_tsn", "wakeup_axi_root", 0x9e40, 0, NULL, PLAT_IMX91, }, /* Critical because clk accessed during CPU idle */ { IMX93_CLK_SYS_CNT_GATE, "sys_cnt", "osc_24m", 0x9e80, CLK_IS_CRITICAL}, { IMX93_CLK_TSTMR1_GATE, "tstmr1", "bus_aon_root", 0x9ec0, },
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 135/623 clk: qcom: camcc-x1e80100: Set titan_top_gdsc as the parent GDSC of subordinate GDSCs
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bryan O'Donoghue <[email protected]>
[ Upstream commit d9377941f2732d2f6f53ec9520321a19c687717a ]
The Titan TOP GDSC is the parent GDSC for all other GDSCs in the CAMCC block. None of the subordinate blocks will switch on without the parent GDSC switched on.
--- drivers/clk/qcom/camcc-x1e80100.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/qcom/camcc-x1e80100.c +7 -0
@@ -2212,6 +2212,8 @@ static struct clk_branch cam_cc_sfe_0_fast_ahb_clk = { }, }; +static struct gdsc cam_cc_titan_top_gdsc; +static struct gdsc cam_cc_bps_gdsc = { .gdscr =0x10004 , .en_rest_wait_val =0x2 ,
@@ -2221,6 +2223,7 @@ static struct gdsc cam_cc_bps_gdsc = { .name = "cam_cc_bps_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -2233,6 +2236,7 @@ static struct gdsc cam_cc_ife_0_gdsc = { .name = "cam_cc_ife_0_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -2245,6 +2249,7 @@ static struct gdsc cam_cc_ife_1_gdsc = { .name = "cam_cc_ife_1_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -2257,6 +2262,7 @@ static struct gdsc cam_cc_ipe_0_gdsc = { .name = "cam_cc_ipe_0_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -2269,6 +2275,7 @@ static struct gdsc cam_cc_sfe_0_gdsc = { .name = "cam_cc_sfe_0_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .parent = &cam_cc_titan_top_gdsc.pd, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 136/623 team: prevent adding a device which is already a team device lower
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Octavian Purdila <[email protected]>
[ Upstream commit 3fff5da4ca2164bb4d0f1e6cd33f6eb8a0e73e50 ]
Prevent adding a device which is already a team device lower, e.g. adding veth0 if vlan1 was already added and veth0 is a lower of vlan1.
This is not useful in practice and can lead to recursive locking:
$ ip link add veth0 type veth peer name veth1 $ ip link set veth0 up $ ip link set veth1 up $ ip link add link veth0 name veth0.1 type vlan protocol 802.1Q id 1 $ ip link add team0 type team $ ip link set veth0.1 down $ ip link set veth0.1 master team0 team0: Port device veth0.1 added $ ip link set veth0 down $ ip link set veth0 master team0
============================================
WARNING: possible recursive locking detected
6.13.0-rc2-virtme-00441-ga14a429069bb #46 Not tainted
--------------------------------------------
ip/7684 is trying to acquire lock:ffff888016848e00 (team->team_lock_key){+.+.}-{4:4}, at: team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973)
but task is already holding lock:ffff888016848e00 (team->team_lock_key){+.+.}-{4:4}, at: team_add_slave (drivers/net/team/team_core.c:1147 drivers/net/team/team_core.c:1977)
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----lock(team->team_lock_key);lock(team->team_lock_key);
*** DEADLOCK ***
May be due to missing lock nesting notation
2 locks held by ip/7684:
stack backtrace: CPU: 3 UID: 0 PID: 7684 Comm: ip Not tainted 6.13.0-rc2-virtme-00441-ga14a429069bb #46 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: <TASK>
dump_stack_lvl (lib/dump_stack.c:122)
print_deadlock_bug.cold (kernel/locking/lockdep.c:3040) __lock_acquire (kernel/locking/lockdep.c:3893 kernel/locking/lockdep.c:5226) ? netlink_broadcast_filtered (net/netlink/af_netlink.c:1548)
lock_acquire.part.0 (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5851) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? trace_lock_acquire (./include/trace/events/lock.h:24 (discriminator 2)) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? lock_acquire (kernel/locking/lockdep.c:5822) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) __mutex_lock (kernel/locking/mutex.c:587 kernel/locking/mutex.c:735) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) ? fib_sync_up (net/ipv4/fib_semantics.c:2167) ? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973)
notifier_call_chain (kernel/notifier.c:85) call_netdevice_notifiers_info (net/core/dev.c:1996) __dev_notify_flags (net/core/dev.c:8993)
? __dev_change_flags (net/core/dev.c:8975) dev_change_flags (net/core/dev.c:9027) vlan_device_event (net/8021q/vlan.c:85 net/8021q/vlan.c:470) ? br_device_event (net/bridge/br.c:143) notifier_call_chain (kernel/notifier.c:85) call_netdevice_notifiers_info (net/core/dev.c:1996)
dev_open (net/core/dev.c:1519 net/core/dev.c:1505) team_add_slave (drivers/net/team/team_core.c:1219 drivers/net/team/team_core.c:1977)
? __pfx_team_add_slave (drivers/net/team/team_core.c:1972) do_set_master (net/core/rtnetlink.c:2917) do_setlink.isra.0 (net/core/rtnetlink.c:3117)
--- drivers/net/team/team_core.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/team/team_core.c +7 -0
@@ -1175,6 +1175,13 @@ static int team_port_add(struct team *team, struct net_device *port_dev,return -EBUSY ; } +if (netdev_has_upper_dev (port_dev, dev)) { +NL_SET_ERR_MSG (extack,"Device is already a lower device of the team interface" ); +netdev_err (dev,"Device %s is already a lower device of the team interface\n" , + portname); +return -EBUSY ; + } +if (port_dev->features &NETIF_F_VLAN_CHALLENGED &&vlan_uses_dev (dev)) {NL_SET_ERR_MSG (extack,"Device is VLAN challenged and team device has VLAN set up" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 137/623 cpufreq/amd-pstate: Fix prefcore rankings
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
[ Upstream commit fd604ae6c261c5a56bb977ae99f875bbd7264a3f ]
commit 50a062a76200 ("cpufreq/amd-pstate: Store the boost numerator as highest perf again") updated the value stored for highest perf to no longer store the highest perf value but instead the boost numerator.
This is a fixed value for systems with preferred cores and not appropriate for use ITMT rankings. Update the value used for ITMT rankings to be the preferred core ranking.
--- drivers/cpufreq/amd-pstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/amd-pstate.c +1 -1
@@ -802,7 +802,7 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)* sched_set_itmt_support(true) has been called and it is valid to * update them at any time after it has been called. */ -sched_set_itmt_core_prio ((int )READ_ONCE (cpudata->highest_perf), cpudata->cpu); +sched_set_itmt_core_prio ((int )READ_ONCE (cpudata->prefcore_ranking), cpudata->cpu);schedule_work (&sched_prefcore_work); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 138/623 clk: sunxi-ng: a64: stop force-selecting PLL-MIPI as TCON0 parent
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Khoruzhick <[email protected]>
[ Upstream commit 383ca7bee8a93be9ff5a072936981c2710d2856b ]
Stop force-selecting PLL-MIPI as TCON0 parent, since it breaks video output on Pinebook that uses RGB to eDP bridge.
Partially revert commit ca1170b69968 ("clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux"), while still leaving CLK_SET_RATE_NO_REPARENT flag set, since we do not want the clock to be reparented.
The issue is that apparently different TCON0 outputs require a different clock, or the mux might be selecting the output type.
I did an experiment: I manually configured PLL_MIPI and PLL_VIDEO0_2X to the same clock rate and flipped the switch with devmem. Experiment clearly showed that whenever PLL_MIPI is selected as TCON0 clock parent, the video output stops working.
Therefore, TCON0 clock parent corresponding to the output type must be assigned in the device tree.
--- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/clk/sunxi-ng/ccu-sun50i-a64.c +4 -9
@@ -535,11 +535,11 @@ static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, CLK_SET_RATE_PARENT);/* -* DSI output seems to work only when PLL_MIPI selected. Set it and prevent -* the mux from reparenting. +* Experiments showed that RGB output requires pll-video0-2x, while DSI +* requires pll-mipi. It will not work with incorrect clock, the screen will +* be blank. +* sun50i-a64.dtsi assigns pll-mipi as TCON0 parent by default */ -#define SUN50I_A64_TCON0_CLK_REG 0x118 -static const char *const tcon0_parents[] = {"pll-mipi" ,"pll-video0-2x" };static const u8 tcon0_table[] = {0 ,2 , }; static SUNXI_CCU_MUX_TABLE_WITH_GATE_CLOSEST(tcon0_clk, "tcon0", tcon0_parents,
@@ -959,11 +959,6 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev)writel (0x515 , reg +SUN50I_A64_PLL_MIPI_REG ); -/* Set PLL MIPI as parent for TCON0 */ - val =readl (reg +SUN50I_A64_TCON0_CLK_REG ); - val &= ~GENMASK (26 ,24 ); -writel (val | (0 <<24 ), reg +SUN50I_A64_TCON0_CLK_REG ); - ret =devm_sunxi_ccu_probe (&pdev->dev, reg, &sun50i_a64_ccu_desc);if (ret)return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 139/623 regulator: of: Implement the unwind path of of_regulator_match()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit dddca3b2fc676113c58b04aaefe84bfb958ac83e ]
of_regulator_match() does not release the OF node reference in the error path, resulting in an OF node leak. Therefore, call of_node_put() on the obtained nodes before returning the EINVAL error.
Since it is possible that some drivers call this function and do not exit on failure, such as s2mps11_pmic_driver, clear the init_data and of_node in the error path.
This was reported by an experimental verification tool that I am developing. As I do not have access to actual devices nor the QEMU board configuration to test drivers that call this function, no runtime test was able to be performed.
--- drivers/regulator/of_regulator.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/regulator/of_regulator.c +13 -1
@@ -446,7 +446,7 @@ int of_regulator_match(struct device *dev, struct device_node *node,"failed to parse DT for regulator %pOFn\n" , child);of_node_put (child); -return -EINVAL ; + goto err_put; } match->of_node =of_node_get (child); count++;
@@ -455,6 +455,18 @@ int of_regulator_match(struct device *dev, struct device_node *node, }return count; + +err_put: +for (i =0 ; i < num_matches; i++) { +struct of_regulator_match *match = &matches[i]; + + match->init_data =NULL ; +if (match->of_node) { +of_node_put (match->of_node); + match->of_node =NULL ; + } + } +return -EINVAL ; }EXPORT_SYMBOL_GPL (of_regulator_match);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 140/623 ax25: rcu protect dev->ax25_ptr
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 95fc45d1dea8e1253f8ec58abc5befb71553d666 ]
syzbot found a lockdep issue [1].
We should remove ax25 RTNL dependency in ax25_setsockopt()
This should also fix a variety of possible UAF in ax25.
[1]
WARNING: possible circular locking dependency detected 6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0 Not tainted
------------------------------------------------------
syz.5.1818/12806 is trying to acquire lock:
ffffffff8fcb3988 (rtnl_mutex){+.+.}-{4:4}, at: ax25_setsockopt+0xa55/0xe90 net/ax25/af_ax25.c:680
but task is already holding lock:
ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1618 [inline] ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: ax25_setsockopt+0x209/0xe90 net/ax25/af_ax25.c:574
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (sk_lock-AF_AX25){+.+.}-{0:0}:
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
lock_sock_nested+0x48/0x100 net/core/sock.c:3642
lock_sock include/net/sock.h:1618 [inline]
ax25_kill_by_device net/ax25/af_ax25.c:101 [inline]
ax25_device_event+0x24d/0x580 net/ax25/af_ax25.c:146
notifier_call_chain+0x1a5/0x3f0 kernel/notifier.c:85
__dev_notify_flags+0x207/0x400
dev_change_flags+0xf0/0x1a0 net/core/dev.c:9026
dev_ifsioc+0x7c8/0xe70 net/core/dev_ioctl.c:563
dev_ioctl+0x719/0x1340 net/core/dev_ioctl.c:820
sock_do_ioctl+0x240/0x460 net/socket.c:1234
sock_ioctl+0x626/0x8e0 net/socket.c:1339
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:906 [inline]
__se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7f-> #0 (rtnl_mutex){+.+.}-{4:4}:
check_prev_add kernel/locking/lockdep.c:3161 [inline]
check_prevs_add kernel/locking/lockdep.c:3280 [inline]
validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904
__lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226
lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849
__mutex_lock_common kernel/locking/mutex.c:585 [inline]
__mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735
ax25_setsockopt+0xa55/0xe90 net/ax25/af_ax25.c:680
do_sock_setsockopt+0x3af/0x720 net/socket.c:2324
__sys_setsockopt net/socket.c:2349 [inline]
__do_sys_setsockopt net/socket.c:2355 [inline]
__se_sys_setsockopt net/socket.c:2352 [inline]
__x64_sys_setsockopt+0x1ee/0x280 net/socket.c:2352
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x77/0x7fother info that might help us debug this:
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(sk_lock-AF_AX25);
lock(rtnl_mutex);
lock(sk_lock-AF_AX25); lock(rtnl_mutex);
*** DEADLOCK ***
1 lock held by syz.5.1818/12806:
#0: ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1618 [inline] #0: ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: ax25_setsockopt+0x209/0xe90 net/ax25/af_ax25.c:574
stack backtrace: CPU: 1 UID: 0 PID: 12806 Comm: syz.5.1818 Not tainted 6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735 ax25_setsockopt+0xa55/0xe90 net/ax25/af_ax25.c:680 do_sock_setsockopt+0x3af/0x720 net/socket.c:2324 __sys_setsockopt net/socket.c:2349 [inline] __do_sys_setsockopt net/socket.c:2355 [inline] __se_sys_setsockopt net/socket.c:2352 [inline] __x64_sys_setsockopt+0x1ee/0x280 net/socket.c:2352 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f7b62385d29
--- include/linux/netdevice.h | 2 +- include/net/ax25.h | 10 +++++----- net/ax25/af_ax25.c | 12 ++++++------ net/ax25/ax25_dev.c | 4 ++-- net/ax25/ax25_ip.c | 3 ++- net/ax25/ax25_out.c | 22 +++++++++++++++++----- net/ax25/ax25_route.c | 2 ++ 7 files changed, 35 insertions(+), 20 deletions(-)
include/linux/netdevice.h +1 -1
@@ -2259,7 +2259,7 @@ struct net_device {void *atalk_ptr;#endif #if IS_ENABLED (CONFIG_AX25 ) -void *ax25_ptr; +struct ax25_dev __rcu *ax25_ptr;#endif #if IS_ENABLED (CONFIG_CFG80211 )struct wireless_dev *ieee80211_ptr;
include/net/ax25.h +5 -5
@@ -231,6 +231,7 @@ typedef struct ax25_dev {#endif refcount_t refcount;bool device_up; +struct rcu_head rcu; } ax25_dev; typedef struct ax25_cb {
@@ -290,9 +291,8 @@ static inline void ax25_dev_hold(ax25_dev *ax25_dev)static inline void ax25_dev_put (ax25_dev *ax25_dev) { -if (refcount_dec_and_test (&ax25_dev->refcount)) { -kfree (ax25_dev); - } +if (refcount_dec_and_test (&ax25_dev->refcount)) +kfree_rcu (ax25_dev, rcu); }static inline __be16 ax25_type_trans (struct sk_buff *skb,struct net_device *dev) {
@@ -335,9 +335,9 @@ void ax25_digi_invert(const ax25_digi *, ax25_digi *);extern spinlock_t ax25_dev_lock;#if IS_ENABLED (CONFIG_AX25 ) -static inline ax25_dev *ax25_dev_ax25dev (struct net_device *dev) +static inline ax25_dev *ax25_dev_ax25dev (const struct net_device *dev) { -return dev->ax25_ptr; +return rcu_dereference_rtnl (dev->ax25_ptr); }#endif
net/ax25/af_ax25.c +6 -6
@@ -467,7 +467,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) goto out_put; } -static void ax25_fillin_cb_from_dev (ax25_cb *ax25,ax25_dev *ax25_dev) +static void ax25_fillin_cb_from_dev (ax25_cb *ax25,const ax25_dev *ax25_dev) { ax25->rtt =msecs_to_jiffies (ax25_dev->values[AX25_VALUES_T1 ]) /2 ; ax25->t1 =msecs_to_jiffies (ax25_dev->values[AX25_VALUES_T1 ]);
@@ -677,22 +677,22 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ; } -rtnl_lock (); - dev =__dev_get_by_name (&init_net, devname); +rcu_read_lock (); + dev =dev_get_by_name_rcu (&init_net, devname);if (!dev) { -rtnl_unlock (); +rcu_read_unlock (); res = -ENODEV ;break ; } ax25->ax25_dev =ax25_dev_ax25dev (dev);if (!ax25->ax25_dev) { -rtnl_unlock (); +rcu_read_unlock (); res = -ENODEV ;break ; }ax25_fillin_cb (ax25, ax25->ax25_dev); -rtnl_unlock (); +rcu_read_unlock ();break ;default :
net/ax25/ax25_dev.c +2 -2
@@ -90,7 +90,7 @@ void ax25_dev_device_up(struct net_device *dev)spin_lock_bh (&ax25_dev_lock);list_add (&ax25_dev->list, &ax25_dev_list); - dev->ax25_ptr = ax25_dev; +rcu_assign_pointer (dev->ax25_ptr, ax25_dev);spin_unlock_bh (&ax25_dev_lock);ax25_register_dev_sysctl (ax25_dev);
@@ -125,7 +125,7 @@ void ax25_dev_device_down(struct net_device *dev) } } - dev->ax25_ptr =NULL ; +RCU_INIT_POINTER (dev->ax25_ptr,NULL );spin_unlock_bh (&ax25_dev_lock);netdev_put (dev, &ax25_dev->dev_tracker);ax25_dev_put (ax25_dev);
net/ax25/ax25_ip.c +2 -1
@@ -122,6 +122,7 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)if (dev ==NULL ) dev = skb->dev; +rcu_read_lock ();if ((ax25_dev =ax25_dev_ax25dev (dev)) ==NULL ) {kfree_skb (skb); goto put;
@@ -202,7 +203,7 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb)ax25_queue_xmit (skb, dev); put: - +rcu_read_unlock ();ax25_route_lock_unuse ();return NETDEV_TX_OK ; }
net/ax25/ax25_out.c +17 -5
@@ -39,10 +39,14 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, const ax25_address *sr* specified. */ if (paclen ==0 ) { -if ((ax25_dev =ax25_dev_ax25dev (dev)) ==NULL ) +rcu_read_lock (); + ax25_dev =ax25_dev_ax25dev (dev); +if (!ax25_dev) { +rcu_read_unlock ();return NULL ; - + } paclen = ax25_dev->values[AX25_VALUES_PACLEN ]; +rcu_read_unlock (); }/*
@@ -53,13 +57,19 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, const ax25_address *srreturn ax25;/* It already existed */ } -if ((ax25_dev =ax25_dev_ax25dev (dev)) ==NULL ) +rcu_read_lock (); + ax25_dev =ax25_dev_ax25dev (dev); +if (!ax25_dev) { +rcu_read_unlock ();return NULL ; + } -if ((ax25 =ax25_create_cb ()) ==NULL ) +if ((ax25 =ax25_create_cb ()) ==NULL ) { +rcu_read_unlock ();return NULL ; - + }ax25_fillin_cb (ax25, ax25_dev); +rcu_read_unlock (); ax25->source_addr = *src; ax25->dest_addr = *dest;
@@ -358,7 +368,9 @@ void ax25_queue_xmit(struct sk_buff *skb, struct net_device *dev) {unsigned char *ptr; +rcu_read_lock (); skb->protocol =ax25_type_trans (skb,ax25_fwd_dev (dev)); +rcu_read_unlock (); ptr =skb_push (skb,1 ); *ptr =0x00 ;/* KISS */
net/ax25/ax25_route.c +2 -0
@@ -406,6 +406,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr)ax25_route_lock_unuse ();return -EHOSTUNREACH ; } +rcu_read_lock ();if ((ax25->ax25_dev =ax25_dev_ax25dev (ax25_rt->dev)) ==NULL ) { err = -EHOSTUNREACH ; goto put;
@@ -442,6 +443,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) } put: +rcu_read_unlock ();ax25_route_lock_unuse ();return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 141/623 net/mlx5: HWS, fix definers HWS_SET32 macro for negative offset
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yevgeny Kliteynik <[email protected]>
[ Upstream commit be482f1d10da781db9445d2753c1e3f1fd82babf ]
When bit offset for HWS_SET32 macro is negative,
UBSAN complains about the shift-out-of-bounds:
UBSAN: shift-out-of-bounds in drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c:177:2 shift exponent -8 is negative
--- drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/hws/definer.c +1 -1
@@ -70,7 +70,7 @@u32 second_dw_mask = (mask) & ((1 << _bit_off) -1 ); \_HWS_SET32 (p, (v) >> _bit_off, byte_off,0 , (mask) >> _bit_off); \_HWS_SET32 (p, (v) & second_dw_mask, (byte_off) +DW_SIZE , \ - (bit_off) %BITS_IN_DW , second_dw_mask); \ + (bit_off +BITS_IN_DW ) %BITS_IN_DW , second_dw_mask); \ }else { \_HWS_SET32 (p, v, byte_off, (bit_off), (mask)); \ } \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 142/623 OPP: OF: Fix an OF node leak in _opp_add_static_v2()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 1d38eb7f7b26261a0b642f6e0923269c7c000a97 ]
_opp_add_static_v2() leaks the obtained OF node reference when _of_opp_alloc_required_opps() fails. Add an of_node_put() call in the error path.
--- drivers/opp/of.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/opp/of.c +3 -1
@@ -926,7 +926,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, ret =_of_opp_alloc_required_opps (opp_table, new_opp);if (ret) - goto free_opp; + goto put_node;if (!of_property_read_u32 (np,"clock-latency-ns" , &val)) new_opp->clock_latency_ns = val;
@@ -976,6 +976,8 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, free_required_opps:_of_opp_free_required_opps (opp_table, new_opp); +put_node: +of_node_put (np); free_opp:_opp_free (new_opp);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 143/623 ipmi: ssif_bmc: Fix new request loss when bmc ready for a response
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quan Nguyen <[email protected]>
[ Upstream commit 83d8c79aa958e37724ed9c14dc7d0f66a48ad864 ]
Cosmo found that when there is a new request comes in while BMC is ready for a response, the complete_response(), which is called to complete the pending response, would accidentally clear out that new request and force ssif_bmc to move back to abort state again.
This commit is to address that issue.
Message-ID: <[email protected]>
--- drivers/char/ipmi/ssif_bmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/char/ipmi/ssif_bmc.c +3 -2
@@ -292,7 +292,6 @@ static void complete_response(struct ssif_bmc_ctx *ssif_bmc) ssif_bmc->nbytes_processed =0 ; ssif_bmc->remain_len =0 ; ssif_bmc->busy = false; -memset (&ssif_bmc->part_buf,0 ,sizeof (struct ssif_part_buffer ));wake_up_all (&ssif_bmc->wait_queue); }
@@ -744,9 +743,11 @@ static void on_stop_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) ssif_bmc->aborting = true; } }else if (ssif_bmc->state ==SSIF_RES_SENDING ) { -if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num ==0xFF ) +if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num ==0xFF ) { +memset (&ssif_bmc->part_buf,0 ,sizeof (struct ssif_part_buffer ));/* Invalidate response buffer to denote it is sent */ complete_response (ssif_bmc); + } ssif_bmc->state =SSIF_READY ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 144/623 wifi: ath12k: fix tx power, max reg power update to firmware
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sathishkumar Muruganandam <[email protected]>
[ Upstream commit 3540bba855b4b422e8b977d11aa8173ccb4f089d ]
Currently, when the vdev start WMI cmd is sent from host, vdev related parameters such as max_reg_power, max_power, and max_antenna_gain are multiplied by 2 before being sent to the firmware. This is incorrect because the firmware uses 1 dBm steps for power calculations.
This leads to incorrect power values being used in the firmware and radio, potentially causing incorrect behavior.
Fix the update of max_reg_power, max_power, and max_antenna_gain values in the ath12k_mac_vdev_start_restart function, ensuring accurate power settings in the firmware by sending these values as-is, without multiplication.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/mac.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +3 -3
@@ -7658,9 +7658,9 @@ ath12k_mac_vdev_start_restart(struct ath12k_link_vif *arvif, chandef->chan->band, ahvif->vif->type); arg.min_power =0 ; - arg.max_power = chandef->chan->max_power *2 ; - arg.max_reg_power = chandef->chan->max_reg_power *2 ; - arg.max_antenna_gain = chandef->chan->max_antenna_gain *2 ; + arg.max_power = chandef->chan->max_power; + arg.max_reg_power = chandef->chan->max_reg_power; + arg.max_antenna_gain = chandef->chan->max_antenna_gain; arg.pref_tx_streams = ar->num_tx_chains; arg.pref_rx_streams = ar->num_rx_chains;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/623 clk: qcom: gcc-sdm845: Do not use shared clk_ops for QUPs
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Pundir <[email protected]>
[ Upstream commit f760a4bb5e927a133dcd75f7b69ccae2a331e42c ]
Similar to the earlier fixes meant for sm8x50 and x1e platforms, we have to stop using the shared clk ops for sdm845 QUPs as well.
As Stephen Boyd pointed out in earlier fixes, there wasn't a problem to mark QUP clks shared until we started parking shared RCGs at clk registration time in commit 01a0a6cc8cfd ("clk: qcom: Park shared RCGs upon registration"). Parking at init is actually harmful to the UART when earlycon is used. If the device is pumping out data while the frequency changes and we see garbage on the serial console until the driver can probe and actually set a proper frequency.
This patch reverts the QUP clk sharing ops part of commit 06391eddb60a ("clk: qcom: Add Global Clock controller (GCC) driver for SDM845"), so that the QUPs on sdm845 don't get parked during clk registration and break UART operations.
--- drivers/clk/qcom/gcc-sdm845.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/clk/qcom/gcc-sdm845.c +16 -16
@@ -454,7 +454,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s0_clk_src_init = { .name = "gcc_qupv3_wrap0_s0_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s0_clk_src = {
@@ -470,7 +470,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s1_clk_src_init = { .name = "gcc_qupv3_wrap0_s1_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s1_clk_src = {
@@ -486,7 +486,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s2_clk_src_init = { .name = "gcc_qupv3_wrap0_s2_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s2_clk_src = {
@@ -502,7 +502,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s3_clk_src_init = { .name = "gcc_qupv3_wrap0_s3_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s3_clk_src = {
@@ -518,7 +518,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s4_clk_src_init = { .name = "gcc_qupv3_wrap0_s4_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s4_clk_src = {
@@ -534,7 +534,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s5_clk_src_init = { .name = "gcc_qupv3_wrap0_s5_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s5_clk_src = {
@@ -550,7 +550,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s6_clk_src_init = { .name = "gcc_qupv3_wrap0_s6_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s6_clk_src = {
@@ -566,7 +566,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s7_clk_src_init = { .name = "gcc_qupv3_wrap0_s7_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap0_s7_clk_src = {
@@ -582,7 +582,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s0_clk_src_init = { .name = "gcc_qupv3_wrap1_s0_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s0_clk_src = {
@@ -598,7 +598,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s1_clk_src_init = { .name = "gcc_qupv3_wrap1_s1_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s1_clk_src = {
@@ -614,7 +614,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s2_clk_src_init = { .name = "gcc_qupv3_wrap1_s2_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s2_clk_src = {
@@ -630,7 +630,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s3_clk_src_init = { .name = "gcc_qupv3_wrap1_s3_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s3_clk_src = {
@@ -646,7 +646,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s4_clk_src_init = { .name = "gcc_qupv3_wrap1_s4_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s4_clk_src = {
@@ -662,7 +662,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s5_clk_src_init = { .name = "gcc_qupv3_wrap1_s5_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s5_clk_src = {
@@ -678,7 +678,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s6_clk_src_init = { .name = "gcc_qupv3_wrap1_s6_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s6_clk_src = {
@@ -694,7 +694,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s7_clk_src_init = { .name = "gcc_qupv3_wrap1_s7_clk_src", .parent_data = gcc_parent_data_0, .num_parents = ARRAY_SIZE(gcc_parent_data_0), - .ops = &clk_rcg2_shared_ops, + .ops = &clk_rcg2_ops, };static struct clk_rcg2 gcc_qupv3_wrap1_s7_clk_src = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/623 HID: hid-thrustmaster: Fix warning in thrustmaster_probe by adding endpoint check
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karol Przybylski <[email protected]>
[ Upstream commit 50420d7c79c37a3efe4010ff9b1bb14bc61ebccf ]
syzbot has found a type mismatch between a USB pipe and the transfer endpoint, which is triggered by the hid-thrustmaster driver[1]. There is a number of similar, already fixed issues [2].
In this case as in others, implementing check for endpoint type fixes the issue.
[1] https://syzkaller.appspot.com/bug?extid=040e8b3db6a96908d470
[2] https://syzkaller.appspot.com/bug?extid=348331f63b034f89b622
--- drivers/hid/hid-thrustmaster.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/hid/hid-thrustmaster.c +8 -0
@@ -170,6 +170,14 @@ static void thrustmaster_interrupts(struct hid_device *hdev) ep = &usbif->cur_altsetting->endpoint[1 ]; b_ep = ep->desc.bEndpointAddress; +/* Are the expected endpoints present? */ +u8 ep_addr[1 ] = {b_ep}; + +if (!usb_check_int_endpoints (usbif, ep_addr)) { +hid_err (hdev,"Unexpected non-int endpoint\n" ); +return ; + } +for (i =0 ; i <ARRAY_SIZE (setup_arr); ++i) {memcpy (send_buf, setup_arr[i], setup_arr_sizes[i]);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/623 HID: fix generic desktop D-Pad controls
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Terry Tritton <[email protected]>
[ Upstream commit 80818fdc068eaab729bb793d790ae9fd053f7053 ]
The addition of the "System Do Not Disturb" event code caused the Generic Desktop D-Pad configuration to be skipped. This commit allows both to be configured without conflicting with each other.
--- drivers/hid/hid-input.c | 37 +++++++++++++++++-------------------- include/linux/hid.h | 1 + 2 files changed, 18 insertions(+), 20 deletions(-)
drivers/hid/hid-input.c +17 -20
@@ -810,10 +810,23 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielbreak ; } -if ((usage->hid &0xf0 ) ==0x90 ) {/* SystemControl*/ -switch (usage->hid &0xf ) { -case 0xb :map_key_clear (KEY_DO_NOT_DISTURB );break ; -default : goto ignore; +if ((usage->hid &0xf0 ) ==0x90 ) {/* SystemControl & D-pad */ +switch (usage->hid) { +case HID_GD_UP : usage->hat_dir =1 ;break ; +case HID_GD_DOWN : usage->hat_dir =5 ;break ; +case HID_GD_RIGHT : usage->hat_dir =3 ;break ; +case HID_GD_LEFT : usage->hat_dir =7 ;break ; +case HID_GD_DO_NOT_DISTURB : +map_key_clear (KEY_DO_NOT_DISTURB );break ; +default : goto unknown; + } + +if (usage->hid <=HID_GD_LEFT ) { +if (field->dpad) { +map_abs (field->dpad); + goto ignore; + } +map_abs (ABS_HAT0X ); }break ; }
@@ -844,22 +857,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fielif (field->application ==HID_GD_SYSTEM_CONTROL ) goto ignore; -if ((usage->hid &0xf0 ) ==0x90 ) {/* D-pad */ -switch (usage->hid) { -case HID_GD_UP : usage->hat_dir =1 ;break ; -case HID_GD_DOWN : usage->hat_dir =5 ;break ; -case HID_GD_RIGHT : usage->hat_dir =3 ;break ; -case HID_GD_LEFT : usage->hat_dir =7 ;break ; -default : goto unknown; - } -if (field->dpad) { -map_abs (field->dpad); - goto ignore; - } -map_abs (ABS_HAT0X ); -break ; - } -switch (usage->hid) {/* These usage IDs map directly to the usage codes. */ case HID_GD_X :case HID_GD_Y :case HID_GD_Z :
include/linux/hid.h +1 -0
@@ -218,6 +218,7 @@ struct hid_item {#define HID_GD_DOWN 0x00010091#define HID_GD_RIGHT 0x00010092#define HID_GD_LEFT 0x00010093 +#define HID_GD_DO_NOT_DISTURB 0x0001009b/* Microsoft Win8 Wireless Radio Controls CA usage codes */ #define HID_GD_RFKILL_BTN 0x000100c6#define HID_GD_RFKILL_LED 0x000100c7
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/623 leds: cht-wcove: Use devm_led_classdev_register() to avoid memory leak
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Hattori <[email protected]>
[ Upstream commit 417cad5dc782096350e6a967ee5dd3417a19a24e ]
cht_wc_leds_probe() leaks memory when the second led_classdev_register() call in the for-loop fails as it does not call the cleanup function led_classdev_unregister() on the first device. Avoid this leak by calling devm_led_classdev_register().
--- drivers/leds/leds-cht-wcove.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/leds/leds-cht-wcove.c +1 -5
@@ -394,7 +394,7 @@ static int cht_wc_leds_probe(struct platform_device *pdev) led->cdev.pattern_clear = cht_wc_leds_pattern_clear; led->cdev.max_brightness =255 ; - ret =led_classdev_register (&pdev->dev, &led->cdev); + ret =devm_led_classdev_register (&pdev->dev, &led->cdev);if (ret <0 )return ret; }
@@ -406,10 +406,6 @@ static int cht_wc_leds_probe(struct platform_device *pdev)static void cht_wc_leds_remove (struct platform_device *pdev) {struct cht_wc_leds *leds =platform_get_drvdata (pdev); -int i; - -for (i =0 ; i <CHT_WC_LED_COUNT ; i++) -led_classdev_unregister (&leds->leds[i].cdev);/* Restore LED1 regs if hw-control was active else leave LED1 off */ if (!(leds->led1_initial_regs.ctrl &CHT_WC_LED1_SWCTL ))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/623 mfd: syscon: Fix race in device_node_get_regmap()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Herring (Arm) <[email protected]>
[ Upstream commit 805f7aaf7fee14a57b56af01d270edf6c10765e8 ]
It is possible for multiple, simultaneous callers calling device_node_get_regmap() with the same node to fail to find an entry in the syscon_list. There is a period of time while the first caller is calling of_syscon_register() that subsequent callers also fail to find an entry in the syscon_list and then call of_syscon_register() a second time.
Fix this by keeping the lock held until after of_syscon_register() completes and adds the node to syscon_list. Convert the spinlock to a mutex as many of the functions called in of_syscon_register() such as kzalloc() and of_clk_get() may sleep.
--- drivers/mfd/syscon.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/mfd/syscon.c +10 -9
@@ -15,6 +15,7 @@#include <linux/io.h> #include <linux/init.h> #include <linux/list.h> +#include <linux/mutex.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_platform.h>
@@ -27,7 +28,7 @@static struct platform_driver syscon_driver; -static DEFINE_SPINLOCK (syscon_list_slock); +static DEFINE_MUTEX (syscon_list_lock);static LIST_HEAD (syscon_list);struct syscon {
@@ -54,6 +55,8 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)struct resource res;struct reset_control *reset; +WARN_ON (!mutex_is_locked (&syscon_list_lock)); + struct syscon *syscon __free(kfree) = kzalloc(sizeof(*syscon), GFP_KERNEL);if (!syscon)return ERR_PTR (-ENOMEM );
@@ -146,9 +149,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) syscon->regmap = regmap; syscon->np = np; -spin_lock (&syscon_list_slock);list_add_tail (&syscon->list, &syscon_list); -spin_unlock (&syscon_list_slock);return_ptr (syscon);
@@ -169,7 +170,7 @@ static struct regmap *device_node_get_regmap(struct device_node *np, {struct syscon *entry, *syscon =NULL ; -spin_lock (&syscon_list_slock); +mutex_lock (&syscon_list_lock);list_for_each_entry (entry, &syscon_list, list)if (entry->np == np) {
@@ -177,11 +178,11 @@ static struct regmap *device_node_get_regmap(struct device_node *np,break ; } -spin_unlock (&syscon_list_slock); -if (!syscon) syscon =of_syscon_register (np, check_res); +mutex_unlock (&syscon_list_lock); +if (IS_ERR (syscon))return ERR_CAST (syscon);
@@ -212,7 +213,7 @@ int of_syscon_register_regmap(struct device_node *np, struct regmap *regmap)return -ENOMEM ;/* check if syscon entry already exists */ -spin_lock (&syscon_list_slock); +mutex_lock (&syscon_list_lock);list_for_each_entry (entry, &syscon_list, list)if (entry->np == np) {
@@ -225,12 +226,12 @@ int of_syscon_register_regmap(struct device_node *np, struct regmap *regmap)/* register the regmap in syscon list */ list_add_tail (&syscon->list, &syscon_list); -spin_unlock (&syscon_list_slock); +mutex_unlock (&syscon_list_lock);return 0 ; err_unlock: -spin_unlock (&syscon_list_slock); +mutex_unlock (&syscon_list_lock);kfree (syscon);return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/623 samples/landlock: Fix possible NULL dereference in parse_path()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zichen Xie <[email protected]>
[ Upstream commit 078bf9438a31567e2c0587159ccefde835fb1ced ]
malloc() may return NULL, leading to NULL dereference. Add a NULL check.
--- samples/landlock/sandboxer.c | 7 +++++++ 1 file changed, 7 insertions(+)
samples/landlock/sandboxer.c +7 -0
@@ -91,6 +91,9 @@ static int parse_path(char *env_path, const char ***const path_list) } } *path_list =malloc (num_paths *sizeof (**path_list)); +if (!*path_list) +return -1 ; +for (i =0 ; i < num_paths; i++) (*path_list)[i] =strsep (&env_path,ENV_DELIMITER );
@@ -127,6 +130,10 @@ static int populate_ruleset_fs(const char *const env_var, const int ruleset_fd, env_path_name =strdup (env_path_name);unsetenv (env_var); num_paths =parse_path (env_path_name, &path_list); +if (num_paths <0 ) { +fprintf (stderr,"Failed to allocate memory\n" ); + goto out_free_name; + }if (num_paths ==1 && path_list[0 ][0 ] =='\0' ) {/* * Allows to not use all possible restrictions (e.g. use
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/623 wifi: mt76: mt7996: fix invalid interface combinations
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shayne Chen <[email protected]>
[ Upstream commit 89aca45f26879dfbbf8374c425c4811f69cfc2df ]
Setting beacon_int_min_gcd and NL80211_IFTYPE_ADHOC in the same interface combination is invalid, which will trigger the following warning trace and get error returned from wiphy_register().
[ 10.080325] Call trace: [ 10.082761] wiphy_register+0xc4/0x76c [cfg80211] [ 10.087465] ieee80211_register_hw+0x800/0xac4 [mac80211] [ 10.092868] mt76_register_device+0x16c/0x2c0 [mt76] [ 10.097829] mt7996_register_device+0x740/0x844 [mt7996e]
Fix this by removing unused adhoc iftype.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +0 -3
@@ -16,9 +16,6 @@static const struct ieee80211_iface_limit if_limits[] = { { - .max =1 , - .types =BIT (NL80211_IFTYPE_ADHOC ) - }, { .max =16 , .types =BIT (NL80211_IFTYPE_AP ) #ifdef CONFIG_MAC80211_MESH
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/623 wifi: wilc1000: unregister wiphy only if it has been registered
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
[ Upstream commit 1be94490b6b8a06ff14cd23fda8714e6ec37cdfb ]
There is a specific error path in probe functions in wilc drivers (both sdio and spi) which can lead to kernel panic, as this one for example when using SPI:
Unable to handle kernel paging request at virtual address 9f000000 when read [9f000000] *pgd=00000000 Internal error: Oops: 5 [#1] ARM Modules linked in: wilc1000_spi(+) crc_itu_t crc7 wilc1000 cfg80211 bluetooth ecdh_generic ecc CPU: 0 UID: 0 PID: 106 Comm: modprobe Not tainted 6.13.0-rc3+ #22 Hardware name: Atmel SAMA5 PC is at wiphy_unregister+0x244/0xc40 [cfg80211] LR is at wiphy_unregister+0x1c0/0xc40 [cfg80211]
[...]
wiphy_unregister [cfg80211] from wilc_netdev_cleanup+0x380/0x494 [wilc1000] wilc_netdev_cleanup [wilc1000] from wilc_bus_probe+0x360/0x834 [wilc1000_spi] wilc_bus_probe [wilc1000_spi] from spi_probe+0x15c/0x1d4 spi_probe from really_probe+0x270/0xb2c
really_probe from __driver_probe_device+0x1dc/0x4e8 __driver_probe_device from driver_probe_device+0x5c/0x140 driver_probe_device from __driver_attach+0x220/0x540 __driver_attach from bus_for_each_dev+0x13c/0x1a8 bus_for_each_dev from bus_add_driver+0x2a0/0x6a4
bus_add_driver from driver_register+0x27c/0x51c
driver_register from do_one_initcall+0xf8/0x564
do_one_initcall from do_init_module+0x2e4/0x82c
do_init_module from load_module+0x59a0/0x70c4
load_module from init_module_from_file+0x100/0x148 init_module_from_file from sys_finit_module+0x2fc/0x924 sys_finit_module from ret_fast_syscall+0x0/0x1c
The issue can easily be reproduced, for example by not wiring correctly a wilc device through SPI (and so, make it unresponsive to early SPI commands). It is due to a recent change decoupling wiphy allocation from wiphy registration, however wilc_netdev_cleanup has not been updated accordingly, letting it possibly call wiphy unregister on a wiphy which has never been registered.
Fix this crash by moving wiphy_unregister/wiphy_free out of wilc_netdev_cleanup, and by adjusting error paths in both drivers
--- drivers/net/wireless/microchip/wilc1000/netdev.c | 2 -- drivers/net/wireless/microchip/wilc1000/sdio.c | 9 +++++++-- drivers/net/wireless/microchip/wilc1000/spi.c | 9 +++++++-- 3 files changed, 14 insertions(+), 6 deletions(-)
drivers/net/wireless/microchip/wilc1000/netdev.c +0 -2
@@ -925,8 +925,6 @@ void wilc_netdev_cleanup(struct wilc *wilc)wilc_wlan_cfg_deinit (wilc);wlan_deinit_locks (wilc); -wiphy_unregister (wilc->wiphy); -wiphy_free (wilc->wiphy); }EXPORT_SYMBOL_GPL (wilc_netdev_cleanup);
drivers/net/wireless/microchip/wilc1000/sdio.c +7 -2
@@ -193,7 +193,7 @@ static int wilc_sdio_probe(struct sdio_func *func, ret =wilc_load_mac_from_nv (wilc);if (ret) {pr_err ("Can not retrieve MAC address from chip\n" ); - goto dispose_irq; + goto unregister_wiphy; }wilc_sdio_deinit (wilc);
@@ -202,15 +202,18 @@ static int wilc_sdio_probe(struct sdio_func *func, NL80211_IFTYPE_STATION, false);if (IS_ERR (vif)) { ret =PTR_ERR (vif); - goto dispose_irq; + goto unregister_wiphy; }dev_info (&func->dev,"Driver Initializing success\n" );return 0 ; +unregister_wiphy: +wiphy_unregister (wilc->wiphy); dispose_irq:irq_dispose_mapping (wilc->dev_irq_num);wilc_netdev_cleanup (wilc); +wiphy_free (wilc->wiphy); free:kfree (sdio_priv->cmd53_buf);kfree (sdio_priv);
@@ -222,7 +225,9 @@ static void wilc_sdio_remove(struct sdio_func *func)struct wilc *wilc =sdio_get_drvdata (func);struct wilc_sdio *sdio_priv = wilc->bus_data; +wiphy_unregister (wilc->wiphy);wilc_netdev_cleanup (wilc); +wiphy_free (wilc->wiphy);kfree (sdio_priv->cmd53_buf);kfree (sdio_priv); }
drivers/net/wireless/microchip/wilc1000/spi.c +7 -2
@@ -256,7 +256,7 @@ static int wilc_bus_probe(struct spi_device *spi) ret =wilc_load_mac_from_nv (wilc);if (ret) {pr_err ("Can not retrieve MAC address from chip\n" ); - goto power_down; + goto unregister_wiphy; }wilc_wlan_power (wilc, false);
@@ -264,14 +264,17 @@ static int wilc_bus_probe(struct spi_device *spi) NL80211_IFTYPE_STATION, false);if (IS_ERR (vif)) { ret =PTR_ERR (vif); - goto power_down; + goto unregister_wiphy; }return 0 ; +unregister_wiphy: +wiphy_unregister (wilc->wiphy); power_down:wilc_wlan_power (wilc, false); netdev_cleanup:wilc_netdev_cleanup (wilc); +wiphy_free (wilc->wiphy); free:kfree (spi_priv);return ret;
@@ -282,7 +285,9 @@ static void wilc_bus_remove(struct spi_device *spi)struct wilc *wilc =spi_get_drvdata (spi);struct wilc_spi *spi_priv = wilc->bus_data; +wiphy_unregister (wilc->wiphy);wilc_netdev_cleanup (wilc); +wiphy_free (wilc->wiphy);kfree (spi_priv); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/623 wifi: wlcore: fix unbalanced pm_runtime calls
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
[ Upstream commit 996c934c8c196144af386c4385f61fcd5349af28 ]
If firmware boot failes, runtime pm is put too often:
[12092.708099] wlcore: ERROR firmware boot failed despite 3 retries [12092.708099] wl18xx_driver wl18xx.1.auto: Runtime PM usage count underflow!
Fix that by redirecting all error gotos before runtime_get so that runtime is not put.
--- drivers/net/wireless/ti/wlcore/main.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/ti/wlcore/main.c +5 -5
@@ -2612,24 +2612,24 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,if (test_bit (WL1271_FLAG_RECOVERY_IN_PROGRESS , &wl->flags) ||test_bit (WLVIF_FLAG_INITIALIZED , &wlvif->flags)) { ret = -EBUSY ; - goto out; + goto out_unlock; } ret =wl12xx_init_vif_data (wl, vif);if (ret <0 ) - goto out; + goto out_unlock; wlvif->wl = wl; role_type =wl12xx_get_role_type (wl, wlvif);if (role_type ==WL12XX_INVALID_ROLE_TYPE ) { ret = -EINVAL ; - goto out; + goto out_unlock; } ret =wlcore_allocate_hw_queue_base (wl, wlvif);if (ret <0 ) - goto out; + goto out_unlock;/* * TODO: after the nvs issue will be solved, move this block
@@ -2644,7 +2644,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ret =wl12xx_init_fw (wl);if (ret <0 ) - goto out; + goto out_unlock; }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/623 wifi: rtw89: fix proceeding MCC with wrong scanning state after sequence changes
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zong-Zhe Yang <[email protected]>
[ Upstream commit e47f0a5898540eb19b953708707887d4b3020645 ]
When starting/proceeding MCC, it will abort an ongoing hw scan process. In the proceeding cases, it unexpectedly tries to abort a non-exist hw scan process. Then, a trace shown at the bottom will happen. This problem is caused by a previous commit which changed some call sequence inside rtw89_hw_scan_complete() to fix some coex problems. These changes lead to our scanning flag was not cleared when proceeding MCC. To keep the fixes on coex, and resolve the problem here, re-consider the related call sequence.
The known sequence requirements are listed below.
* the old sequence:
A. notify coex
B. clear scanning flag
C. proceed chanctx
C-1. set channel
C-2. proceed MCC
(the problem: A needs to be after C-1)
* the current sequence:
C. proceed chanctx
C-1. set channel
C-2. proceed MCC
A. notify coex
B. clear scanning flag
(the problem: C-2 needs to be after B)
So, now let hw scan caller pass a callback to proceed chanctx if needed. Then, the new sequence will be like the below.
C-1. set channel
A. notify coex
B. clear scanning flag
C-2. proceed MCC
The following is the kernel log for the problem in current sequence.
rtw89_8852be 0000:04:00.0: rtw89_hw_scan_offload failed ret -110
------------[ cut here ]------------ [...] CPU: 2 PID: 3991 Comm: kworker/u16:0 Tainted: G OE 6.6.17 #3 Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB3WW (2.73 ) 11/28/2018 Workqueue: events_unbound wiphy_work_cancel [cfg80211] RIP: 0010:ieee80211_sched_scan_stopped+0xaea/0xd80 [mac80211] Code: 9c 24 d0 11 00 00 49 39 dd 0f 85 46 ff ff ff 4c 89 e7 e8 09 2d RSP: 0018:ffffb27783643d48 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff8a2280964bc0 RSI: 0000000000000000 RDI: ffff8a23df580900 RBP: ffffb27783643d88 R08: 0000000000000001 R09: 0000000000000400 R10: 0000000000000000 R11: 0000000000008268 R12: ffff8a23df580900 R13: ffff8a23df581b00 R14: 0000000000000000 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8a258e680000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f26a0654000 CR3: 000000002ea2e002 CR4: 00000000001706e0 Call Trace: <TASK> ? show_regs+0x68/0x70 ? ieee80211_sched_scan_stopped+0xaea/0xd80 [mac80211] ? __warn+0x8f/0x150 ? ieee80211_sched_scan_stopped+0xaea/0xd80 [mac80211] ? report_bug+0x1f5/0x200 ? handle_bug+0x46/0x80 ? exc_invalid_op+0x19/0x70 ? asm_exc_invalid_op+0x1b/0x20 ? ieee80211_sched_scan_stopped+0xaea/0xd80 [mac80211] ieee80211_scan_work+0x14a/0x650 [mac80211] ? __queue_work+0x10f/0x410 wiphy_work_cancel+0x2fb/0x310 [cfg80211] process_scheduled_works+0x9d/0x390 ? __pfx_worker_thread+0x10/0x10 worker_thread+0x15b/0x2d0 ? __pfx_worker_thread+0x10/0x10 kthread+0x108/0x140 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x3c/0x60 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK> ---[ end trace 0000000000000000 ]---
--- drivers/net/wireless/realtek/rtw89/chan.c | 26 +++++++++++++-- drivers/net/wireless/realtek/rtw89/chan.h | 9 ++++- drivers/net/wireless/realtek/rtw89/core.c | 2 +- drivers/net/wireless/realtek/rtw89/fw.c | 40 +++++++++++++++++++---- 4 files changed, 66 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtw89/chan.c +24 -2
@@ -2530,7 +2530,25 @@ void rtw89_chanctx_pause(struct rtw89_dev *rtwdev, hal->entity_pause = true; } -void rtw89_chanctx_proceed (struct rtw89_dev *rtwdev) +static void rtw89_chanctx_proceed_cb (struct rtw89_dev *rtwdev, +const struct rtw89_chanctx_cb_parm *parm) +{ +int ret; + +if (!parm || !parm->cb) +return ; + + ret = parm->cb (rtwdev, parm->data); +if (ret) +rtw89_warn (rtwdev,"%s (%s): cb failed: %d\n" , __func__, + parm->caller ?:"unknown" , ret); +} + +/* pass @cb_parm if there is a @cb_parm->cb which needs to invoke right after +* call rtw89_set_channel() and right before proceed entity according to mode. +*/ +void rtw89_chanctx_proceed (struct rtw89_dev *rtwdev, +const struct rtw89_chanctx_cb_parm *cb_parm) {struct rtw89_hal *hal = &rtwdev->hal;enum rtw89_entity_mode mode;
@@ -2538,14 +2556,18 @@ void rtw89_chanctx_proceed(struct rtw89_dev *rtwdev)lockdep_assert_held (&rtwdev->mutex); -if (!hal->entity_pause) +if (unlikely (!hal->entity_pause)) { +rtw89_chanctx_proceed_cb (rtwdev, cb_parm);return ; + }rtw89_debug (rtwdev,RTW89_DBG_CHAN ,"chanctx proceed\n" ); hal->entity_pause = false;rtw89_set_channel (rtwdev); +rtw89_chanctx_proceed_cb (rtwdev, cb_parm); + mode =rtw89_get_entity_mode (rtwdev);switch (mode) {case RTW89_ENTITY_MODE_MCC :
drivers/net/wireless/realtek/rtw89/chan.h +8 -1
@@ -38,6 +38,12 @@ enum rtw89_chanctx_pause_reasons { RTW89_CHANCTX_PAUSE_REASON_ROC, }; +struct rtw89_chanctx_cb_parm { +int (*cb)(struct rtw89_dev *rtwdev,void *data); +void *data; +const char *caller; +}; +struct rtw89_entity_weight {unsigned int active_chanctxs;unsigned int active_roles;
@@ -100,7 +106,8 @@ void rtw89_queue_chanctx_change(struct rtw89_dev *rtwdev,void rtw89_chanctx_track (struct rtw89_dev *rtwdev);void rtw89_chanctx_pause (struct rtw89_dev *rtwdev,enum rtw89_chanctx_pause_reasons rsn); -void rtw89_chanctx_proceed (struct rtw89_dev *rtwdev); +void rtw89_chanctx_proceed (struct rtw89_dev *rtwdev, +const struct rtw89_chanctx_cb_parm *cb_parm); const struct rtw89_chan *__rtw89_mgnt_chan_get(struct rtw89_dev *rtwdev, const char *caller_message,
drivers/net/wireless/realtek/rtw89/core.c +1 -1
@@ -3257,7 +3257,7 @@ void rtw89_roc_end(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif) roc->state =RTW89_ROC_IDLE ;rtw89_config_roc_chandef (rtwdev, rtwvif_link->chanctx_idx,NULL ); -rtw89_chanctx_proceed (rtwdev); +rtw89_chanctx_proceed (rtwdev,NULL ); ret =rtw89_core_send_nullfunc (rtwdev, rtwvif_link, true, false);if (ret) rtw89_debug(rtwdev, RTW89_DBG_TXRX,
drivers/net/wireless/realtek/rtw89/fw.c +33 -7
@@ -6780,22 +6780,25 @@ void rtw89_hw_scan_start(struct rtw89_dev *rtwdev,rtw89_chanctx_pause (rtwdev,RTW89_CHANCTX_PAUSE_REASON_HW_SCAN ); } -void rtw89_hw_scan_complete (struct rtw89_dev *rtwdev, -struct rtw89_vif_link *rtwvif_link, -bool aborted) +struct rtw89_hw_scan_complete_cb_data { +struct rtw89_vif_link *rtwvif_link; +bool aborted; +}; + +static int rtw89_hw_scan_complete_cb (struct rtw89_dev *rtwdev,void *data) {const struct rtw89_mac_gen_def *mac = rtwdev->chip->mac_def;struct rtw89_hw_scan_info *scan_info = &rtwdev->scan_info; +struct rtw89_hw_scan_complete_cb_data *cb_data = data; +struct rtw89_vif_link *rtwvif_link = cb_data->rtwvif_link;struct cfg80211_scan_info info = { - .aborted = aborted, + .aborted = cb_data->aborted, };struct rtw89_vif *rtwvif;u32 reg;if (!rtwvif_link) -return ; - -rtw89_chanctx_proceed (rtwdev); +return -EINVAL ; rtwvif = rtwvif_link->rtwvif;
@@ -6814,6 +6817,29 @@ void rtw89_hw_scan_complete(struct rtw89_dev *rtwdev, scan_info->last_chan_idx =0 ; scan_info->scanning_vif =NULL ; scan_info->abort = false; + +return 0 ; +} + +void rtw89_hw_scan_complete (struct rtw89_dev *rtwdev, +struct rtw89_vif_link *rtwvif_link, +bool aborted) +{ +struct rtw89_hw_scan_complete_cb_data cb_data = { + .rtwvif_link = rtwvif_link, + .aborted = aborted, + }; +const struct rtw89_chanctx_cb_parm cb_parm = { + .cb = rtw89_hw_scan_complete_cb, + .data = &cb_data, + .caller = __func__, + }; + +/* The things here needs to be done after setting channel (for coex) +* and before proceeding entity mode (for MCC). So, pass a callback +* of them for the right sequence rather than doing them directly. +*/ +rtw89_chanctx_proceed (rtwdev, &cb_parm); } void rtw89_hw_scan_abort(struct rtw89_dev *rtwdev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/623 wifi: rtw89: chan: fix soft lockup in rtw89_entity_recalc_mgnt_roles()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zong-Zhe Yang <[email protected]>
[ Upstream commit e4790b3e314a4814f1680a5dc552031fb199b878 ]
During rtw89_entity_recalc_mgnt_roles(), there is a normalizing process which will re-order the list if an entry with target pattern is found. And once one is found, should have aborted the list_for_each_entry. But, break just aborted the inner for-loop. The outer list_for_each_entry still continues. Normally, only the first entry will match the target pattern, and the re-ordering will change nothing, so there won't be soft lockup. However, in some special cases, soft lockup would happen.
Fix it by goto fill to break from the list_for_each_entry.
The following is a sample of kernel log for this problem.
watchdog: BUG: soft lockup - CPU#1 stuck for 26s! [wpa_supplicant:2055] [...] RIP: 0010:rtw89_entity_recalc ([...] chan.c:392 chan.c:479) rtw89_core
[...]
--- drivers/net/wireless/realtek/rtw89/chan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/chan.c +2 -1
@@ -391,11 +391,12 @@ static void rtw89_entity_recalc_mgnt_roles(struct rtw89_dev *rtwdev)list_del (&role->mgnt_entry);list_add (&role->mgnt_entry, &mgnt->active_list); -break ; + goto fill; } } } +fill:list_for_each_entry (role, &mgnt->active_list, mgnt_entry) {if (unlikely (pos >=RTW89_MAX_INTERFACE_NUM )) { rtw89_warn(rtwdev,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/623 wifi: rtw89: correct header conversion rule for MLO only
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Po-Hao Huang <[email protected]>
[ Upstream commit b2658bf4d7f2f2e37ae9d2463ecc40618f587834 ]
Header conversion should only be used with MLO connections. Otherwise P2P connection fails due to wrong probe responses sent. Fix it accordingly.
--- drivers/net/wireless/realtek/rtw89/core.c | 9 ++++++++- drivers/net/wireless/realtek/rtw89/core.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.c +8 -1
@@ -931,6 +931,11 @@ rtw89_core_tx_update_desc_info(struct rtw89_dev *rtwdev,bool is_bmc;u16 seq; +if (tx_req->sta) + desc_info->mlo = tx_req->sta->mlo; +else if (tx_req->vif) + desc_info->mlo =ieee80211_vif_is_mld (tx_req->vif); + seq = (le16_to_cpu (hdr->seq_ctrl) &IEEE80211_SCTL_SEQ ) >>4 ;if (tx_req->tx_type !=RTW89_CORE_TX_TYPE_FWCMD ) { tx_type =rtw89_core_get_tx_type (rtwdev, skb);
@@ -938,7 +943,7 @@ rtw89_core_tx_update_desc_info(struct rtw89_dev *rtwdev, addr_cam =rtw89_get_addr_cam_of (tx_req->rtwvif_link, tx_req->rtwsta_link); -if (addr_cam->valid) +if (addr_cam->valid && desc_info->mlo) upd_wlan_hdr = true; } is_bmc = (is_broadcast_ether_addr(hdr->addr1) ||
@@ -1078,6 +1083,8 @@ int rtw89_core_tx_write(struct rtw89_dev *rtwdev, struct ieee80211_vif *vif, } tx_req.skb = skb; + tx_req.vif = vif; + tx_req.sta = sta; tx_req.rtwvif_link = rtwvif_link; tx_req.rtwsta_link = rtwsta_link;
drivers/net/wireless/realtek/rtw89/core.h +3 -0
@@ -1163,12 +1163,15 @@ struct rtw89_tx_desc_info {bool stbc;bool ldpc;bool upd_wlan_hdr; +bool mlo; };struct rtw89_core_tx_request {enum rtw89_core_tx_type tx_type;struct sk_buff *skb; +struct ieee80211_vif *vif; +struct ieee80211_sta *sta;struct rtw89_vif_link *rtwvif_link;struct rtw89_sta_link *rtwsta_link;struct rtw89_tx_desc_info desc_info;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/623 wifi: rtw89: avoid to init mgnt_entry list twice when WoWLAN failed
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chih-Kang Chang <[email protected]>
[ Upstream commit 2f7667675df1b40b73ecc53b4b8c3189b1e5f2c1 ]
If WoWLAN failed in resume flow, the rtw89_ops_add_interface() triggered without removing the interface first. Then the mgnt_entry list init again, causing the list_empty() check in rtw89_chanctx_ops_assign_vif() useless, and list_add_tail() again. Therefore, we have added a check to prevent double adding of the list.
rtw89_8852ce 0000:01:00.0: failed to check wow status disabledrtw89_8852ce 0000:01:00.0: wow: failed to check disable fw readyrtw89_8852ce 0000:01:00.0: wow: failed to swap to normal fwrtw89_8852ce 0000:01:00.0: failed to disable wowrtw89_8852ce 0000:01:00.0: failed to resume for wow -110rtw89_8852ce 0000:01:00.0: MAC has already powered oni2c_hid_acpi i2c-ILTK0001:00: PM: acpi_subsys_resume+0x0/0x60 returned 0 after 284705 usecs list_add corruption. prev->next should be next (ffff9d9719d82228), but was ffff9d9719f96030. (prev=ffff9d9719f96030).
------------[ cut here ]------------ kernel BUG at lib/list_debug.c:34! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI CPU: 2 PID: 6918 Comm: kworker/u8:19 Tainted: G U O Hardware name: Google Anraggar/Anraggar, BIOS Google_Anraggar.15217.514.0 03/25/2024 Workqueue: events_unbound async_run_entry_fn RIP: 0010:__list_add_valid_or_report+0x9f/0xb0 Code: e8 56 89 ff ff 0f 0b 48 c7 c7 3e fc e0 96 48 89 c6 e8 45 89 ff ... RSP: 0018:ffffa51b42bbbaf0 EFLAGS: 00010246 RAX: 0000000000000075 RBX: ffff9d9719d82ab0 RCX: 13acb86e047a4400 RDX: 3fffffffffffffff RSI: 0000000000000000 RDI: 00000000ffffdfff RBP: ffffa51b42bbbb28 R08: ffffffff9768e250 R09: 0000000000001fff R10: ffffffff9765e250 R11: 0000000000005ffd R12: ffff9d9719f95c40 R13: ffff9d9719f95be8 R14: ffff9d97081bfd78 R15: ffff9d9719d82060 FS: 0000000000000000(0000) GS:ffff9d9a6fb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007e7d029a4060 CR3: 0000000345e38000 CR4: 0000000000750ee0 PKRU: 55555554 Call Trace: <TASK> ? __die_body+0x68/0xb0 ? die+0xaa/0xd0 ? do_trap+0x9f/0x170 ? __list_add_valid_or_report+0x9f/0xb0 ? __list_add_valid_or_report+0x9f/0xb0 ? handle_invalid_op+0x69/0x90 ? __list_add_valid_or_report+0x9f/0xb0 ? exc_invalid_op+0x3c/0x50 ? asm_exc_invalid_op+0x16/0x20 ? __list_add_valid_or_report+0x9f/0xb0 rtw89_chanctx_ops_assign_vif+0x1f9/0x210 [rtw89_core cbb375c44bf28564ce479002bff66617a25d9ac1] ? __mutex_unlock_slowpath+0xa0/0xf0 rtw89_ops_assign_vif_chanctx+0x4b/0x90 [rtw89_core cbb375c44bf28564ce479002bff66617a25d9ac1] drv_assign_vif_chanctx+0xa7/0x1f0 [mac80211 6efaad16237edaaea0868b132d4f93ecf918a8b6] ieee80211_reconfig+0x9cb/0x17b0 [mac80211 6efaad16237edaaea0868b132d4f93ecf918a8b6] ? __pfx_wiphy_resume+0x10/0x10 [cfg80211 572d03acaaa933fe38251be7fce3b3675284b8ed] ? dev_printk_emit+0x51/0x70 ? _dev_info+0x6e/0x90 wiphy_resume+0x89/0x180 [cfg80211 572d03acaaa933fe38251be7fce3b3675284b8ed] ? __pfx_wiphy_resume+0x10/0x10 [cfg80211 572d03acaaa933fe38251be7fce3b3675284b8ed] dpm_run_callback+0x37/0x1e0 device_resume+0x26d/0x4b0 ? __pfx_dpm_watchdog_handler+0x10/0x10 async_resume+0x1d/0x30 async_run_entry_fn+0x29/0xd0 worker_thread+0x397/0x970 kthread+0xed/0x110 ? __pfx_worker_thread+0x10/0x10 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x38/0x50 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK>
--- drivers/net/wireless/realtek/rtw89/mac80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/mac80211.c +3 -3
@@ -189,10 +189,10 @@ static int rtw89_ops_add_interface(struct ieee80211_hw *hw,rtw89_core_txq_init (rtwdev, vif->txq); -if (!rtw89_rtwvif_in_list (rtwdev, rtwvif)) +if (!rtw89_rtwvif_in_list (rtwdev, rtwvif)) {list_add_tail (&rtwvif->list, &rtwdev->rtwvifs_list); - -INIT_LIST_HEAD (&rtwvif->mgnt_entry); +INIT_LIST_HEAD (&rtwvif->mgnt_entry); + }ether_addr_copy (rtwvif->mac_addr, vif->addr);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/623 wifi: rtw89: mcc: consider time limits not divisible by 1024
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zong-Zhe Yang <[email protected]>
[ Upstream commit 35642ba31dc4a1816a20191e90156a9e329beb10 ]
For each MCC role, time limits, including max_tob_us, max_toa_us, and mac_dur_us, are calculated if there are NoA attributes. The relation between these time limits is "max_dur_us = max_tob_us + max_toa_us". Then, the unit is converted from us to TU. However, originally, each time limit was divided by 1024 independently. It missed to consider the cases that max_tob_us or max_toa_us is not divisible by 1024. It causes the result breaks "max_dur (TU) = max_tob (TU) + max_toa (TU)". Finally, when MCC calculates pattern parameters based on these kinds of time limits, it might not perform well.
--- drivers/net/wireless/realtek/rtw89/chan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/chan.c +1 -1
@@ -802,7 +802,7 @@ static void rtw89_mcc_fill_role_limit(struct rtw89_dev *rtwdev, mcc_role->limit.max_toa = max_toa_us /1024 ; mcc_role->limit.max_tob = max_tob_us /1024 ; - mcc_role->limit.max_dur = max_dur_us /1024 ; + mcc_role->limit.max_dur = mcc_role->limit.max_toa + mcc_role->limit.max_tob; mcc_role->limit.enable = true; rtw89_debug(rtwdev, RTW89_DBG_CHAN,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/623 wifi: rtw89: fix race between cancel_hw_scan and hw_scan completion
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ping-Ke Shih <[email protected]>
[ Upstream commit ba4bb0402c60e945c4c396c51f0acac3c3e3ea5c ]
The rtwdev->scanning flag isn't protected by mutex originally, so cancel_hw_scan can pass the condition, but suddenly hw_scan completion unset the flag and calls ieee80211_scan_completed() that will free local->hw_scan_req. Then, cancel_hw_scan raises null-ptr-deref and use-after-free. Fix it by moving the check condition to where protected by mutex.
KASAN: null-ptr-deref in range [0x0000000000000088-0x000000000000008f] CPU: 2 PID: 6922 Comm: kworker/2:2 Tainted: G OE Hardware name: LENOVO 2356AD1/2356AD1, BIOS G7ETB6WW (2.76 ) 09/10/2019 Workqueue: events cfg80211_conn_work [cfg80211] RIP: 0010:rtw89_fw_h2c_scan_offload_be+0xc33/0x13c3 [rtw89_core] Code: 00 45 89 6c 24 1c 0f 85 23 01 00 00 48 8b 85 20 ff ff ff 48 8d RSP: 0018:ffff88811fd9f068 EFLAGS: 00010206 RAX: dffffc0000000000 RBX: ffff88811fd9f258 RCX: 0000000000000001 RDX: 0000000000000011 RSI: 0000000000000001 RDI: 0000000000000089 RBP: ffff88811fd9f170 R08: 0000000000000000 R09: 0000000000000000 R10: ffff88811fd9f108 R11: 0000000000000000 R12: ffff88810e47f960 R13: 0000000000000000 R14: 000000000000ffff R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff8881d6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007531dfca55b0 CR3: 00000001be296004 CR4: 00000000001706e0 Call Trace: <TASK> ? show_regs+0x61/0x73 ? __die_body+0x20/0x73 ? die_addr+0x4f/0x7b ? exc_general_protection+0x191/0x1db ? asm_exc_general_protection+0x27/0x30 ? rtw89_fw_h2c_scan_offload_be+0xc33/0x13c3 [rtw89_core] ? rtw89_fw_h2c_scan_offload_be+0x458/0x13c3 [rtw89_core] ? __pfx_rtw89_fw_h2c_scan_offload_be+0x10/0x10 [rtw89_core] ? do_raw_spin_lock+0x75/0xdb ? __pfx_do_raw_spin_lock+0x10/0x10 rtw89_hw_scan_offload+0xb5e/0xbf7 [rtw89_core] ? _raw_spin_unlock+0xe/0x24 ? __mutex_lock.constprop.0+0x40c/0x471 ? __pfx_rtw89_hw_scan_offload+0x10/0x10 [rtw89_core] ? __mutex_lock_slowpath+0x13/0x1f ? mutex_lock+0xa2/0xdc ? __pfx_mutex_lock+0x10/0x10 rtw89_hw_scan_abort+0x58/0xb7 [rtw89_core] rtw89_ops_cancel_hw_scan+0x120/0x13b [rtw89_core] ieee80211_scan_cancel+0x468/0x4d0 [mac80211] ieee80211_prep_connection+0x858/0x899 [mac80211] ieee80211_mgd_auth+0xbea/0xdde [mac80211] ? __pfx_ieee80211_mgd_auth+0x10/0x10 [mac80211] ? cfg80211_find_elem+0x15/0x29 [cfg80211] ? is_bss+0x1b7/0x1d7 [cfg80211] ieee80211_auth+0x18/0x27 [mac80211] cfg80211_mlme_auth+0x3bb/0x3e7 [cfg80211] cfg80211_conn_do_work+0x410/0xb81 [cfg80211] ? __pfx_cfg80211_conn_do_work+0x10/0x10 [cfg80211] ? __kasan_check_read+0x11/0x1f ? psi_group_change+0x8bc/0x944 ? __kasan_check_write+0x14/0x22 ? mutex_lock+0x8e/0xdc ? __pfx_mutex_lock+0x10/0x10 ? __pfx___radix_tree_lookup+0x10/0x10 cfg80211_conn_work+0x245/0x34d [cfg80211] ? __pfx_cfg80211_conn_work+0x10/0x10 [cfg80211] ? update_cfs_rq_load_avg+0x3bc/0x3d7 ? sched_clock_noinstr+0x9/0x1a ? sched_clock+0x10/0x24 ? sched_clock_cpu+0x7e/0x42e ? newidle_balance+0x796/0x937 ? __pfx_sched_clock_cpu+0x10/0x10 ? __pfx_newidle_balance+0x10/0x10 ? __kasan_check_read+0x11/0x1f ? psi_group_change+0x8bc/0x944 ? _raw_spin_unlock+0xe/0x24 ? raw_spin_rq_unlock+0x47/0x54 ? raw_spin_rq_unlock_irq+0x9/0x1f ? finish_task_switch.isra.0+0x347/0x586 ? __schedule+0x27bf/0x2892 ? mutex_unlock+0x80/0xd0 ? do_raw_spin_lock+0x75/0xdb ? __pfx___schedule+0x10/0x10 process_scheduled_works+0x58c/0x821 worker_thread+0x4c7/0x586 ? __kasan_check_read+0x11/0x1f kthread+0x285/0x294 ? __pfx_worker_thread+0x10/0x10 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x29/0x6f ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1b/0x30 </TASK>
--- drivers/net/wireless/realtek/rtw89/mac80211.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/mac80211.c +3 -3
@@ -1273,11 +1273,11 @@ static void rtw89_ops_cancel_hw_scan(struct ieee80211_hw *hw,if (!RTW89_CHK_FW_FEATURE (SCAN_OFFLOAD , &rtwdev->fw))return ; -if (!rtwdev->scanning) -return ; -mutex_lock (&rtwdev->mutex); +if (!rtwdev->scanning) + goto out; + rtwvif_link =rtw89_vif_get_link_inst (rtwvif,0 );if (unlikely (!rtwvif_link)) {rtw89_err (rtwdev,"cancel hw scan: find no link on HW-0\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/623 hwmon: Fix help text for aspeed-g6-pwm-tach
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Stanley <[email protected]>
[ Upstream commit c8571eab11131cce6dcce76b3345c1524e074071 ]
The help text has the wrong module name mentioned, and the capitalisation of the title is inconsistent.
--- drivers/hwmon/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/Kconfig +2 -2
@@ -413,7 +413,7 @@ config SENSORS_ASPEED will be called aspeed_pwm_tacho. config SENSORS_ASPEED_G6 - tristate "ASPEED g6 PWM and Fan tach driver" + tristate "ASPEED G6 PWM and Fan tach driver" depends on ARCH_ASPEED || COMPILE_TEST depends on PWM help
@@ -421,7 +421,7 @@ config SENSORS_ASPEED_G6 controllers. This driver can also be built as a module. If so, the module - will be called aspeed_pwm_tacho. + will be called aspeed_g6_pwm_tach. config SENSORS_ATXP1 tristate "Attansic ATXP1 VID controller"
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/623 wifi: mt76: mt7925: fix off by one in mt7925_load_clc()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 08fa656c91fd5fdf47ba393795b9c0d1e97539ed ]
This comparison should be >= instead of > to prevent an out of bounds read and write.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +1 -1
@@ -638,7 +638,7 @@ static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name)for (offset =0 ; offset < len; offset +=le32_to_cpu (clc->len)) { clc = (const struct mt7925_clc *)(clc_base + offset); -if (clc->idx >ARRAY_SIZE (phy->clc)) +if (clc->idx >=ARRAY_SIZE (phy->clc))break ;/* do not init buf again if chip reset triggered */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/623 wifi: mt76: mt7915: Fix mesh scan on MT7916 DBDC
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Cavallari <[email protected]>
[ Upstream commit f21b77cb556296116b1cce1d62295d13e35da574 ]
commit c4f075582304 ("wifi: mt76: mt7915: fix command timeout in AP stop period") changes the behavior of mt7915_bss_info_changed() in mesh mode when enable_beacon becomes false: it calls mt7915_mcu_add_bss_info(..., false) and mt7915_mcu_add_sta(..., false) while the previous code didn't. These sends mcu commands that apparently confuse the firmware.
This breaks scanning while in mesh mode on AsiaRF MT7916 DBDC-based cards:
scanning works but no mesh frames get sent afterwards and the firmware seems to be hosed. It breaks on MT7916 DBDC but not on MT7915 DBDC.
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +2 -1
@@ -619,8 +619,9 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw,if (changed &BSS_CHANGED_ASSOC ) set_bss_info = vif->cfg.assoc;if (changed &BSS_CHANGED_BEACON_ENABLED && + info->enable_beacon && vif->type !=NL80211_IFTYPE_AP ) - set_bss_info = set_sta = info->enable_beacon; + set_bss_info = set_sta =1 ;if (set_bss_info ==1 )mt7915_mcu_add_bss_info (phy, vif, true);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/623 wifi: iwlwifi: fw: read STEP table from correct UEFI var
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 80c2b651fe7fc82e1d1b3e4f9651095896a095f0 ]
This variable exists for the "common" (WiFi/BT) GUID, not the WiFi-only GUID. Fix that by passing the GUID to the function. A short-cut for the wifi-only version remains so not all code must be updated.
However, rename the GUID defines to be clearer.
--- drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 44 +++++++++++++------- 1 file changed, 30 insertions(+), 14 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/uefi.c +30 -14
@@ -13,9 +13,12 @@#include <linux/efi.h> #include "fw/runtime.h" -#define IWL_EFI_VAR_GUID EFI_GUID(0x92daaf2f, 0xc02b, 0x455b, \ - 0xb2, 0xec, 0xf5, 0xa3, \ - 0x59, 0x4f, 0x4a, 0xea) +#define IWL_EFI_WIFI_GUID EFI_GUID(0x92daaf2f, 0xc02b, 0x455b, \ + 0xb2, 0xec, 0xf5, 0xa3, \ + 0x59, 0x4f, 0x4a, 0xea) +#define IWL_EFI_WIFI_BT_GUID EFI_GUID(0xe65d8884, 0xd4af, 0x4b20, \ + 0x8d, 0x03, 0x77, 0x2e, \ + 0xcc, 0x3d, 0xa5, 0x31)struct iwl_uefi_pnvm_mem_desc {__le32 addr;
@@ -61,7 +64,7 @@ void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len) *len =0 ; - data =iwl_uefi_get_variable (IWL_UEFI_OEM_PNVM_NAME , &IWL_EFI_VAR_GUID , + data =iwl_uefi_get_variable (IWL_UEFI_OEM_PNVM_NAME , &IWL_EFI_WIFI_GUID , &package_size);if (IS_ERR (data)) { IWL_DEBUG_FW(trans,
@@ -76,18 +79,18 @@ void *iwl_uefi_get_pnvm(struct iwl_trans *trans, size_t *len)return data; } -static -void *iwl_uefi_get_verified_variable (struct iwl_trans *trans, -efi_char16_t *uefi_var_name, -char *var_name, -unsigned int expected_size, -unsigned long *size) +static void * +iwl_uefi_get_verified_variable_guid (struct iwl_trans *trans, +efi_guid_t *guid, +efi_char16_t *uefi_var_name, +char *var_name, +unsigned int expected_size, +unsigned long *size) {void *var;unsigned long var_size; - var =iwl_uefi_get_variable (uefi_var_name, &IWL_EFI_VAR_GUID , - &var_size); + var =iwl_uefi_get_variable (uefi_var_name, guid, &var_size);if (IS_ERR (var)) { IWL_DEBUG_RADIO(trans,
@@ -112,6 +115,18 @@ void *iwl_uefi_get_verified_variable(struct iwl_trans *trans,return var; } +static void * +iwl_uefi_get_verified_variable (struct iwl_trans *trans, +efi_char16_t *uefi_var_name, +char *var_name, +unsigned int expected_size, +unsigned long *size) +{ +return iwl_uefi_get_verified_variable_guid (trans, &IWL_EFI_WIFI_GUID , + uefi_var_name, var_name, + expected_size, size); +} +int iwl_uefi_handle_tlv_mem_desc (struct iwl_trans *trans,const u8 *data,u32 tlv_len,struct iwl_pnvm_image *pnvm_data) {
@@ -311,8 +326,9 @@ void iwl_uefi_get_step_table(struct iwl_trans *trans)if (trans->trans_cfg->device_family <IWL_DEVICE_FAMILY_AX210 )return ; - data =iwl_uefi_get_verified_variable (trans,IWL_UEFI_STEP_NAME , -"STEP" ,sizeof (*data),NULL ); + data =iwl_uefi_get_verified_variable_guid (trans, &IWL_EFI_WIFI_BT_GUID , +IWL_UEFI_STEP_NAME , +"STEP" ,sizeof (*data),NULL );if (IS_ERR (data))return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/623 wifi: iwlwifi: mvm: avoid NULL pointer dereference
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miri Korenblit <[email protected]>
[ Upstream commit cf704a7624f99eb2ffca1a16c69183e85544a613 ]
When iterating over the links of a vif, we need to make sure that the pointer is valid (in other words - that the link exists) before dereferncing it.
Use for_each_vif_active_link that also does the check.
--- drivers/net/wireless/intel/iwlwifi/mvm/coex.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/coex.c +3 -6
@@ -530,18 +530,15 @@ static void iwl_mvm_bt_coex_notif_iterator(void *_data, u8 *mac, struct ieee80211_vif *vif) {struct iwl_mvm *mvm = _data; +struct ieee80211_bss_conf *link_conf; +unsigned int link_id;lockdep_assert_held (&mvm->mutex);if (vif->type !=NL80211_IFTYPE_STATION )return ; -for (int link_id =0 ; - link_id <IEEE80211_MLD_MAX_NUM_LINKS ; - link_id++) { -struct ieee80211_bss_conf *link_conf = -rcu_dereference_check (vif->link_conf[link_id], -lockdep_is_held (&mvm->mutex)); +for_each_vif_active_link (vif, link_conf, link_id) {struct ieee80211_chanctx_conf *chanctx_conf =rcu_dereference_check (link_conf->chanctx_conf,lockdep_is_held (&mvm->mutex));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/623 wifi: iwlwifi: mvm: dont count mgmt frames as MPDU
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Gabay <[email protected]>
[ Upstream commit 76260267ba26a6e513acefa5e7de1200fbeb5b5d ]
When handling TX_CMD notification, for mgmt frames tid is equal to IWL_MAX_TID_COUNT, so with the current logic we'll count that as MPDU, fix that.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +3 -1
@@ -1880,7 +1880,9 @@ static void iwl_mvm_rx_tx_cmd_single(struct iwl_mvm *mvm,IWL_DEBUG_TX_REPLY (mvm,"Next reclaimed packet:%d\n" , next_reclaimed); -iwl_mvm_count_mpdu (mvmsta, sta_id,1 , true,0 ); +if (tid <IWL_MAX_TID_COUNT ) +iwl_mvm_count_mpdu (mvmsta, sta_id,1 , + true,0 ); }else {IWL_DEBUG_TX_REPLY (mvm,"NDP - don't update next_reclaimed\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/623 wifi: iwlwifi: mvm: remove unneeded NULL pointer checks
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emmanuel Grumbach <[email protected]>
[ Upstream commit 79f4b6934dbd7dd6741726ba004a15e25380b8cc ]
Smatch reported that we dereference the data pointer to calculate the expected length before we check it's not NULL. While this is true (and hence needs to be fixed), this will never happen because the data pointer comes from struct iwl_rx_packet object which has the following layout:
struct iwl_rx_packet {
__le32 len_n_flags;
struct iwl_cmd_header hdr;
u8 data[];
} __packed;So, if the pointer to iwl_rx_packet is valid, data will be valid as well.
Remove the NULL pointer check on 'data' to avoid confusing smatch. Also remove the check from similar functions in the same flow that were cargo cult copy-pasted.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +0 -18
@@ -2498,12 +2498,6 @@ static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm,u32 expected_len =sizeof (*data) + data->num_mlo_link_keys *sizeof (status->mlo_keys[0 ]); -if (!data) { -IWL_ERR (mvm,"iwl_wowlan_info_notif data is NULL\n" ); - status =NULL ; -return ; - } -if (len < expected_len) {IWL_ERR (mvm,"Invalid WoWLAN info notification!\n" ); status =NULL ;
@@ -2555,12 +2549,6 @@ iwl_mvm_parse_wowlan_info_notif_v4(struct iwl_mvm *mvm,u32 i;u32 expected_len =sizeof (*data); -if (!data) { -IWL_ERR (mvm,"iwl_wowlan_info_notif data is NULL\n" ); - status =NULL ; -return ; - } -if (has_mlo_keys) expected_len += (data->num_mlo_link_keys *sizeof (status->mlo_keys[0 ]));
@@ -2609,12 +2597,6 @@ iwl_mvm_parse_wowlan_info_notif_v2(struct iwl_mvm *mvm, {u32 i; -if (!data) { -IWL_ERR (mvm,"iwl_wowlan_info_notif data is NULL\n" ); - status =NULL ; -return ; - } -if (len <sizeof (*data)) {IWL_ERR (mvm,"Invalid WoWLAN info notification!\n" ); status =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/623 wifi: mac80211: prohibit deactivating all links
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 7553477cbfd784b128297f9ed43751688415bbaa ]
In the internal API this calls this is a WARN_ON, but that should remain since internally we want to know about bugs that may cause this. Prevent deactivating all links in the debugfs write directly.
--- net/mac80211/debugfs_netdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/debugfs_netdev.c +1 -1
@@ -727,7 +727,7 @@ static ssize_t ieee80211_if_parse_active_links(struct ieee80211_sub_if_data *sda {u16 active_links; -if (kstrtou16 (buf,0 , &active_links)) +if (kstrtou16 (buf,0 , &active_links) || !active_links)return -EINVAL ;return ieee80211_set_active_links (&sdata->vif, active_links) ?: buflen;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/623 wifi: cfg80211: Move cfg80211_scan_req_add_chan() n_channels increment earlier
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 3a0168626c138734490bc52c4105ce8e79d2f923 ]
Since adding __counted_by(n_channels) to struct cfg80211_scan_request, anything adding to the channels array must increment n_channels first. Move n_channels increment earlier.
--- net/wireless/scan.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/wireless/scan.c +1 -2
@@ -763,12 +763,11 @@ static void cfg80211_scan_req_add_chan(struct cfg80211_scan_request *request, } } + request->n_channels++; request->channels[n_channels] = chan;if (add_to_6ghz) request->scan_6ghz_params[request->n_6ghz_params].channel_idx = n_channels; - - request->n_channels++; } static bool cfg80211_find_ssid_match(struct cfg80211_colocated_ap *ap,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/623 wifi: mac80211: fix tid removal during mesh forwarding
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Strohman <[email protected]>
[ Upstream commit 3aaa1a5a9a2ceeb32afa6ea4110a92338a863c33 ]
With change (wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces), a non-zero TID assignment is lost during slow path mesh forwarding.
Prior to this change, ieee80211_rx_h_mesh_fwding() left the TID intact in the header.
As a result of this header corruption, packets belonging to non-zero TIDs will get treating as belonging TID 0 by functions such as ieee80211_get_tid(). While this miscategorization by itself is an issue, there are additional ramifications
due to the fact that skb->priority still reflects the mesh forwarded packet's ingress (correct) TID.
The mt7915 driver inspects the TID recorded within skb->priority and relays this to the hardware/radio during TX. The radio firmware appears to react to this by changing the sequence control header, but it does not also ensure/correct the TID in the QoS control header. As a result, the receiver will see packets with sequence numbers corresponding to the wrong TID. The receiver of the forwarded packet will see TID 0 in QoS control but a sequence number corresponding to the correct (different) TID in sequence control. This causes data stalls for TID 0 until the TID 0 sequence number advances past what the receiver believes it should be due to this bug.
Mesh routing mpath changes cause a brief transition from fast path forwarding to slow path forwarding. Since this bug only affects the slow path forwarding, mpath changes bring opportunity for the bug to be triggered. In the author's case, he was experiencing TID 0 data stalls after mpath changes on an intermediate mesh node.
These observed stalls may be specific
to mediatek radios. But the inconsistency between the packet header and skb->priority may cause problems for other drivers as well. Regardless if this causes connectivity issues on other radios, this change is necessary in order transmit (forward) the packet on the correct TID and to have a consistent view a packet's TID within mac80211.
--- net/mac80211/rx.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/rx.c +1 -0
@@ -3001,6 +3001,7 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta }IEEE80211_IFSTA_MESH_CTR_INC (ifmsh, fwded_frames); +ieee80211_set_qos_hdr (sdata, fwd_skb);ieee80211_add_pending_skb (local, fwd_skb); rx_accept:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/623 wifi: mac80211: Fix common size calculation for ML element
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilan Peer <[email protected]>
[ Upstream commit 19aa842dcbb5860509b7e1b7745dbae0b791f6c4 ]
When the ML type is EPCS the control bitmap is reserved, the length is always 7 and is captured by the 1st octet after the control.
--- include/linux/ieee80211.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
include/linux/ieee80211.h +3 -8
@@ -5055,28 +5055,24 @@ static inline u8 ieee80211_mle_common_size(const u8 *data) {const struct ieee80211_multi_link_elem *mle = (const void *)data;u16 control =le16_to_cpu (mle->control); -u8 common =0 ;switch (u16_get_bits (control,IEEE80211_ML_CONTROL_TYPE )) {case IEEE80211_ML_CONTROL_TYPE_BASIC :case IEEE80211_ML_CONTROL_TYPE_PREQ :case IEEE80211_ML_CONTROL_TYPE_TDLS :case IEEE80211_ML_CONTROL_TYPE_RECONF : +case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS :/* * The length is the first octet pointed by mle->variable so no * need to add anything */ break ; -case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS : -if (control &IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR ) - common +=ETH_ALEN ; -return common;default :WARN_ON (1 );return 0 ; } -return sizeof (*mle) + common + mle->variable[0 ]; +return sizeof (*mle) + mle->variable[0 ]; }/**
@@ -5314,8 +5310,7 @@ static inline bool ieee80211_mle_size_ok(const u8 *data, size_t len) check_common_len = true;break ;case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS : -if (control &IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR ) - common +=ETH_ALEN ; + common =ETH_ALEN +1 ;break ;default :/* we don't know this type */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/623 wifi: mac80211: dont flush non-uploaded STAs
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit aa3ce3f8fafa0b8fb062f28024855ea8cb3f3450 ]
If STA state is pre-moved to AUTHORIZED (such as in IBSS scenarios) and insertion fails, the station is freed. In this case, the driver never knew about the station, so trying to flush it is unexpected and may crash.
Check if the sta was uploaded to the driver before and fix this.
--- net/mac80211/driver-ops.h | 3 +++ 1 file changed, 3 insertions(+)
net/mac80211/driver-ops.h +3 -0
@@ -724,6 +724,9 @@ static inline void drv_flush_sta(struct ieee80211_local *local,if (sdata && !check_sdata_in_driver (sdata))return ; +if (!sta->uploaded) +return ; +trace_drv_flush_sta (local, sdata, &sta->sta);if (local->ops->flush_sta) local->ops->flush_sta (&local->hw, &sdata->vif, &sta->sta);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/623 clk: ralink: mtmips: remove duplicated xtal clock for Ralink SoC RT3883
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergio Paracuellos <[email protected]>
[ Upstream commit 830d8062d25581cf0beaa334486eea06834044da ]
Ralink SoC RT3883 has already 'xtal' defined as a base clock so there is no need to redefine it again in fixed clocks section. Hence, remove the duplicate one from there.
--- drivers/clk/ralink/clk-mtmips.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/ralink/clk-mtmips.c +0 -1
@@ -266,7 +266,6 @@ static int mtmips_register_pherip_clocks(struct device_node *np, }static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { -CLK_FIXED ("xtal" ,NULL ,40000000 ),CLK_FIXED ("periph" ,"xtal" ,40000000 ) };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/623 clk: thead: Fix clk gate registration to pass flags
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Drew Fustini <[email protected]>
[ Upstream commit a826e53fd78c7f07b8ff83446c44b227b2181920 ]
Modify the call to devm_clk_hw_register_gate_parent_data() to actually pass the clk flags from hw.init instead of just 0. This is necessary to allow individual clk gates to specify their own clk flags.
--- drivers/clk/thead/clk-th1520-ap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/thead/clk-th1520-ap.c +2 -1
@@ -1048,7 +1048,8 @@ static int th1520_clk_probe(struct platform_device *pdev) hw =devm_clk_hw_register_gate_parent_data (dev, cg->common.hw.init->name, cg->common.hw.init->parent_data, -0 , base + cg->common.cfg0, + cg->common.hw.init->flags, + base + cg->common.cfg0,ffs (cg->enable) -1 ,0 ,NULL );if (IS_ERR (hw))return PTR_ERR (hw);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/623 clk: thead: Add CLK_IGNORE_UNUSED to fix TH1520 boot
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Drew Fustini <[email protected]>
[ Upstream commit 037705e94bf6e1810b7f9dc077d0e23292229e74 ]
Add the CLK_IGNORE_UNUSED flag to apb_pclk, cpu2peri_x2h_clk, perisys_apb2_hclk and perisys_apb3_hclk.
Without this flag, the boot hangs after "clk: Disabling unused clocks" unless clk_ignore_unused is in the kernel cmdline.
--- drivers/clk/thead/clk-th1520-ap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/thead/clk-th1520-ap.c +4 -4
@@ -657,7 +657,7 @@ static struct ccu_div apb_pclk = { .hw.init = CLK_HW_INIT_PARENTS_DATA("apb-pclk", apb_parents, &ccu_div_ops, - 0), + CLK_IGNORE_UNUSED), }, };
@@ -794,13 +794,13 @@ static CCU_GATE(CLK_X2X_CPUSYS, x2x_cpusys_clk, "x2x-cpusys", axi4_cpusys2_aclk_ 0x134, BIT(7), 0); static CCU_GATE(CLK_CPU2AON_X2H, cpu2aon_x2h_clk, "cpu2aon-x2h", axi_aclk_pd, 0x138, BIT(8), 0); static CCU_GATE(CLK_CPU2PERI_X2H, cpu2peri_x2h_clk, "cpu2peri-x2h", axi4_cpusys2_aclk_pd, - 0x140, BIT(9), 0); + 0x140, BIT(9), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_PERISYS_APB1_HCLK, perisys_apb1_hclk, "perisys-apb1-hclk", perisys_ahb_hclk_pd, 0x150, BIT(9), 0); static CCU_GATE(CLK_PERISYS_APB2_HCLK, perisys_apb2_hclk, "perisys-apb2-hclk", perisys_ahb_hclk_pd, - 0x150, BIT(10), 0); + 0x150, BIT(10), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_PERISYS_APB3_HCLK, perisys_apb3_hclk, "perisys-apb3-hclk", perisys_ahb_hclk_pd, - 0x150, BIT(11), 0); + 0x150, BIT(11), CLK_IGNORE_UNUSED); static CCU_GATE(CLK_PERISYS_APB4_HCLK, perisys_apb4_hclk, "perisys-apb4-hclk", perisys_ahb_hclk_pd, 0x150, BIT(12), 0); static CCU_GATE(CLK_NPU_AXI, npu_axi_clk, "npu-axi", axi_aclk_pd, 0x1c8, BIT(5), 0);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/623 clk: thead: Fix cpu2vp_clk for TH1520 AP_SUBSYS clocks
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Drew Fustini <[email protected]>
[ Upstream commit 3a43cd19f1b8d3f57f835ae50cc869f07902c062 ]
cpu2vp_clk is a gate but was mistakenly in th1520_div_clks[] instead of th1520_gate_clks[].
--- drivers/clk/thead/clk-th1520-ap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/thead/clk-th1520-ap.c +1 -1
@@ -896,7 +896,6 @@ static struct ccu_common *th1520_div_clks[] = { &vo_axi_clk.common, &vp_apb_clk.common, &vp_axi_clk.common, - &cpu2vp_clk.common, &venc_clk.common, &dpu0_clk.common, &dpu1_clk.common,
@@ -916,6 +915,7 @@ static struct ccu_common *th1520_gate_clks[] = { &bmu_clk.common, &cpu2aon_x2h_clk.common, &cpu2peri_x2h_clk.common, + &cpu2vp_clk.common, &perisys_apb1_hclk.common, &perisys_apb2_hclk.common, &perisys_apb3_hclk.common,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/623 net/smc: fix data error when recvmsg with MSG_PEEK flag
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guangguan Wang <[email protected]>
[ Upstream commit a4b6539038c1aa1ae871aacf6e41b566c3613993 ]
When recvmsg with MSG_PEEK flag, the data will be copied to user's buffer without advancing consume cursor and without reducing the length of rx available data. Once the expected peek length is larger than the value of bytes_to_rcv, in the loop of do while in smc_rx_recvmsg, the first loop will copy bytes_to_rcv bytes of data from the position local_tx_ctrl.cons, the second loop will copy the min(bytes_to_rcv, read_remaining) bytes from the position local_tx_ctrl.cons again because of the lacking of process with advancing consume cursor and reducing the length of available data. So do the subsequent loops. The data copied in the second loop and the subsequent loops will result in data error, as it should not be copied if no more data arrives and it should be copied from the position advancing bytes_to_rcv bytes from the local_tx_ctrl.cons if more data arrives.
This issue can be reproduce by the following python script:server.py:
import socket
import timeserver_ip = '0.0.0.0'server_port = 12346server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server_socket.bind((server_ip, server_port)) server_socket.listen(1)
print('Server is running and listening for connections...') conn, addr = server_socket.accept()print('Connected by', addr)
while True:
data = conn.recv(1024)
if not data:
break
print('Received request:', data.decode()) conn.sendall(b'Hello, client!\n')
time.sleep(5)
conn.sendall(b'Hello, again!\n')conn.close()
client.py:
import socketserver_ip = '<server ip>'server_port = 12346
resp=b'Hello, client!\nHello, again!\n'client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client_socket.connect((server_ip, server_port))
request = 'Hello, server!' client_socket.sendall(request.encode())peek_data = client_socket.recv(len(resp),
socket.MSG_PEEK | socket.MSG_WAITALL)print('Peeked data:', peek_data.decode()) client_socket.close()
--- net/smc/af_smc.c | 2 +- net/smc/smc_rx.c | 37 +++++++++++++++++++++---------------- net/smc/smc_rx.h | 8 ++++---- 3 files changed, 26 insertions(+), 21 deletions(-)
net/smc/af_smc.c +1 -1
@@ -2738,7 +2738,7 @@ int smc_accept(struct socket *sock, struct socket *new_sock,release_sock (clcsk); }else if (!atomic_read (&smc_sk (nsk)->conn.bytes_to_rcv)) {lock_sock (nsk); -smc_rx_wait (smc_sk (nsk), &timeo, smc_rx_data_available); +smc_rx_wait (smc_sk (nsk), &timeo,0 , smc_rx_data_available);release_sock (nsk); } }
net/smc/smc_rx.c +21 -16
@@ -238,22 +238,23 @@ static int smc_rx_splice(struct pipe_inode_info *pipe, char *src, size_t len,return -ENOMEM ; } -static int smc_rx_data_available_and_no_splice_pend (struct smc_connection *conn) +static int smc_rx_data_available_and_no_splice_pend (struct smc_connection *conn,size_t peeked) { -return atomic_read (&conn->bytes_to_rcv) && +return smc_rx_data_available (conn, peeked) && !atomic_read (&conn->splice_pending); }/* blocks rcvbuf consumer until >=len bytes available or timeout or interrupted * @smc smc socket * @timeo pointer to max seconds to wait, pointer to value 0 for no timeout +* @peeked number of bytes already peeked * @fcrit add'l criterion to evaluate as function pointer * Returns: * 1 if at least 1 byte available in rcvbuf or if socket error/shutdown. * 0 otherwise (nothing in rcvbuf nor timeout, e.g. interrupted). */ -int smc_rx_wait (struct smc_sock *smc,long *timeo, -int (*fcrit)(struct smc_connection *conn)) +int smc_rx_wait (struct smc_sock *smc,long *timeo,size_t peeked, +int (*fcrit)(struct smc_connection *conn,size_t baseline)) {DEFINE_WAIT_FUNC (wait, woken_wake_function);struct smc_connection *conn = &smc->conn;
@@ -262,7 +263,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo,struct sock *sk = &smc->sk;int rc; -if (fcrit (conn)) +if (fcrit (conn, peeked))return 1 ;sk_set_bit (SOCKWQ_ASYNC_WAITDATA , sk);add_wait_queue (sk_sleep (sk), &wait);
@@ -271,7 +272,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, cflags->peer_conn_abort ||READ_ONCE (sk->sk_shutdown) &RCV_SHUTDOWN || conn->killed || -fcrit (conn), +fcrit (conn, peeked), &wait);remove_wait_queue (sk_sleep (sk), &wait);sk_clear_bit (SOCKWQ_ASYNC_WAITDATA , sk);
@@ -322,11 +323,11 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len,return -EAGAIN ; } -static bool smc_rx_recvmsg_data_available (struct smc_sock *smc) +static bool smc_rx_recvmsg_data_available (struct smc_sock *smc,size_t peeked) {struct smc_connection *conn = &smc->conn; -if (smc_rx_data_available (conn)) +if (smc_rx_data_available (conn, peeked))return true;else if (conn->urg_state ==SMC_URG_VALID )/* we received a single urgent Byte - skip */
@@ -344,10 +345,10 @@ static bool smc_rx_recvmsg_data_available(struct smc_sock *smc)int smc_rx_recvmsg (struct smc_sock *smc,struct msghdr *msg,struct pipe_inode_info *pipe,size_t len,int flags) { -size_t copylen, read_done =0 , read_remaining = len; +size_t copylen, read_done =0 , read_remaining = len, peeked_bytes =0 ;size_t chunk_len, chunk_off, chunk_len_sum;struct smc_connection *conn = &smc->conn; -int (*func)(struct smc_connection *conn); +int (*func)(struct smc_connection *conn,size_t baseline);union smc_host_cursor cons;int readable, chunk;char *rcvbuf_base;
@@ -384,14 +385,14 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg,if (conn->killed)break ; -if (smc_rx_recvmsg_data_available (smc)) +if (smc_rx_recvmsg_data_available (smc, peeked_bytes)) goto copy;if (sk->sk_shutdown &RCV_SHUTDOWN ) {/* smc_cdc_msg_recv_action() could have run after * above smc_rx_recvmsg_data_available() */ -if (smc_rx_recvmsg_data_available (smc)) +if (smc_rx_recvmsg_data_available (smc, peeked_bytes)) goto copy;break ; }
@@ -425,26 +426,28 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, } } -if (!smc_rx_data_available (conn)) { -smc_rx_wait (smc, &timeo, smc_rx_data_available); +if (!smc_rx_data_available (conn, peeked_bytes)) { +smc_rx_wait (smc, &timeo, peeked_bytes, smc_rx_data_available);continue ; } copy:/* initialize variables for 1st iteration of subsequent loop */ /* could be just 1 byte, even after waiting on data above */ - readable =atomic_read (&conn->bytes_to_rcv); + readable =smc_rx_data_available (conn, peeked_bytes); splbytes =atomic_read (&conn->splice_pending);if (!readable || (msg && splbytes)) {if (splbytes) func = smc_rx_data_available_and_no_splice_pend;else func = smc_rx_data_available; -smc_rx_wait (smc, &timeo, func); +smc_rx_wait (smc, &timeo, peeked_bytes, func);continue ; }smc_curs_copy (&cons, &conn->local_tx_ctrl.cons, conn); +if ((flags &MSG_PEEK ) && peeked_bytes) +smc_curs_add (conn->rmb_desc->len, &cons, peeked_bytes);/* subsequent splice() calls pick up where previous left */ if (splbytes)smc_curs_add (conn->rmb_desc->len, &cons, splbytes);
@@ -480,6 +483,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, } read_remaining -= chunk_len; read_done += chunk_len; +if (flags &MSG_PEEK ) + peeked_bytes += chunk_len;if (chunk_len_sum == copylen)break ;/* either on 1st or 2nd iteration */
net/smc/smc_rx.h +4 -4
@@ -21,11 +21,11 @@ void smc_rx_init(struct smc_sock *smc);int smc_rx_recvmsg (struct smc_sock *smc,struct msghdr *msg,struct pipe_inode_info *pipe,size_t len,int flags); -int smc_rx_wait (struct smc_sock *smc,long *timeo, -int (*fcrit)(struct smc_connection *conn)); -static inline int smc_rx_data_available (struct smc_connection *conn) +int smc_rx_wait (struct smc_sock *smc,long *timeo,size_t peeked, +int (*fcrit)(struct smc_connection *conn,size_t baseline)); +static inline int smc_rx_data_available (struct smc_connection *conn,size_t peeked) { -return atomic_read (&conn->bytes_to_rcv); +return atomic_read (&conn->bytes_to_rcv) - peeked; }#endif /* SMC_RX_H */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/623 landlock: Handle weird files
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
[ Upstream commit 49440290a0935f428a1e43a5ac8dc275a647ff80 ]
A corrupted filesystem (e.g. bcachefs) might return weird files. Instead of throwing a warning and allowing access to such file, treat them as regular files.
--- security/landlock/fs.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
security/landlock/fs.c +5 -6
@@ -937,10 +937,6 @@ static access_mask_t get_mode_access(const umode_t mode)switch (mode &S_IFMT ) {case S_IFLNK :return LANDLOCK_ACCESS_FS_MAKE_SYM ; -case 0 : -/* A zero mode translates to S_IFREG. */ -case S_IFREG : -return LANDLOCK_ACCESS_FS_MAKE_REG ;case S_IFDIR :return LANDLOCK_ACCESS_FS_MAKE_DIR ;case S_IFCHR :
@@ -951,9 +947,12 @@ static access_mask_t get_mode_access(const umode_t mode)return LANDLOCK_ACCESS_FS_MAKE_FIFO ;case S_IFSOCK :return LANDLOCK_ACCESS_FS_MAKE_SOCK ; +case S_IFREG : +case 0 : +/* A zero mode translates to S_IFREG. */ default : -WARN_ON_ONCE (1 ); -return 0 ; +/* Treats weird files as regular files. */ +return LANDLOCK_ACCESS_FS_MAKE_REG ; } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/623 wifi: mt76: mt76u_vendor_request: Do not print error messages when -EPROTO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
[ Upstream commit f1b1e133a770fcdbd89551651232b034d2f7a27a ]
When initializing the network card, unplugging the device will trigger an -EPROTO error, resulting in a flood of error messages being printed frantically.
The exception is printed as follows:
mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71
...It will continue to print more than 2000 times for about 5 minutes, causing the usb device to be unable to be disconnected. During this period, the usb port cannot recognize the new device because the old device has not disconnected.
There may be other operating methods that cause -EPROTO, but -EPROTO is a low-level hardware error. It is unwise to repeat vendor requests expecting to read correct data. It is a better choice to treat -EPROTO and -ENODEV the same way.
Similar to commit 9b0f100c1970 ("mt76: usb: process URBs with status EPROTO properly") do no schedule rx_worker for urb marked with status set -EPROTO. I also reproduced this situation when plugging and unplugging the device, and this patch is effective.
Just do not vendor request again for urb marked with status set -EPROTO.
--- drivers/net/wireless/mediatek/mt76/usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/usb.c +2 -2
@@ -33,9 +33,9 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type, ret =usb_control_msg (udev, pipe, req, req_type, val, offset, buf, len,MT_VEND_REQ_TOUT_MS ); -if (ret == -ENODEV ) +if (ret == -ENODEV || ret == -EPROTO )set_bit (MT76_REMOVED , &dev->phy.state); -if (ret >=0 || ret == -ENODEV ) +if (ret >=0 || ret == -ENODEV || ret == -EPROTO )return ret;usleep_range (5000 ,10000 ); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/623 wifi: mt76: mt7921: fix using incorrect group cipher after disconnection.
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Lo <[email protected]>
[ Upstream commit aa566ac6b7272e7ea5359cb682bdca36d2fc7e73 ]
To avoid incorrect cipher after disconnection, we should do the key deletion process in this case.
--- drivers/net/wireless/mediatek/mt76/mt7921/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/main.c +7 -1
@@ -531,7 +531,13 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, }else {if (idx == *wcid_keyidx) *wcid_keyidx =-1 ; - goto out; + +/* For security issue we don't trigger the key deletion when +* reassociating. But we should trigger the deletion process +* to avoid using incorrect cipher after disconnection, +*/ +if (vif->type !=NL80211_IFTYPE_STATION || vif->cfg.assoc) + goto out; }mt76_wcid_key_setup (&dev->mt76, wcid, key);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/623 wifi: mt76: mt7915: Fix an error handling path in mt7915_add_interface()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 126a516fe30639708e759678bcb10178938cc718 ]
If mt76_wcid_alloc() fails, the "mt76.mutex" mutex needs to be released as done in the other error handling paths of mt7915_add_interface().
--- drivers/net/wireless/mediatek/mt76/mt7915/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/main.c +4 -2
@@ -246,8 +246,10 @@ static int mt7915_add_interface(struct ieee80211_hw *hw, phy->omac_mask |=BIT_ULL (mvif->mt76.omac_idx); idx =mt76_wcid_alloc (dev->mt76.wcid_mask,mt7915_wtbl_size (dev)); -if (idx <0 ) -return -ENOSPC ; +if (idx <0 ) { + ret = -ENOSPC ; + goto out; + }INIT_LIST_HEAD (&mvif->sta.rc_list);INIT_LIST_HEAD (&mvif->sta.wcid.poll_list);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/623 wifi: mt76: mt7925: fix NULL deref check in mt7925_change_vif_links
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 5cd0bd815c8a48862a296df9b30e0ea0da14acd3 ]
In mt7925_change_vif_links() devm_kzalloc() may return NULL but this returned value is not checked.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +2 -0
@@ -1946,6 +1946,8 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, GFP_KERNEL); mlink =devm_kzalloc (dev->mt76.dev,sizeof (*mlink),GFP_KERNEL ); +if (!mconf || !mlink) +return -ENOMEM ; } mconfs[link_id] = mconf;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/623 wifi: mt76: mt7925: fix wrong band_idx setting when enable sniffer mode
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric-SY Chang <[email protected]>
[ Upstream commit 85bb7c10c1a013ab29d4be07559105dd843c6f7d ]
Currently, sniffer mode does not support band auto, so set band_idx to the default 0.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +2 -4
@@ -1976,8 +1976,6 @@ int mt7925_get_txpwr_info(struct mt792x_dev *dev, u8 band_idx, struct mt7925_txp int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif, bool enable) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct { struct { u8 band_idx;
@@ -1991,7 +1989,7 @@ int mt7925_mcu_set_sniffer(struct mt792x_dev *dev, struct ieee80211_vif *vif, }__packed enable; }__packed req = { .hdr = { - .band_idx = mvif->bss_conf.mt76.band_idx, + .band_idx =0 , }, .enable = { .tag =cpu_to_le16 (UNI_SNIFFER_ENABLE ),
@@ -2050,7 +2048,7 @@ int mt7925_mcu_config_sniffer(struct mt792x_vif *vif, }__packed tlv; }__packed req = { .hdr = { - .band_idx = vif->bss_conf.mt76.band_idx, + .band_idx =0 , }, .tlv = { .tag =cpu_to_le16 (UNI_SNIFFER_CONFIG ),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/623 wifi: mt76: mt7925: fix get wrong chip cap from incorrect pointer
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 4d264f31b3074d361f65702dd7969861bcf1c158 ]
Use tlv instead of skb, because using skb will get valid data with wrong offset.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +1 -1
@@ -823,7 +823,7 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev)mt7925_mcu_parse_phy_cap (dev, tlv->data);break ;case MT_NIC_CAP_CHIP_CAP : -memcpy (&dev->phy.chip_cap, (void *)skb->data,sizeof (u64)); + dev->phy.chip_cap =le64_to_cpu (*(__le64 *)tlv->data);break ;case MT_NIC_CAP_EML_CAP :mt7925_mcu_parse_eml_cap (dev, tlv->data);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/623 wifi: mt76: mt7925: fix the invalid ip address for arp offload
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 113d469e7e23579a64b0fbb2eadf9228763092be ]
The wrong ieee80211_vif will lead to get invalid ip address and the correct ieee80211_vif can be obtained from ieee80211_bss_conf.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +1 -3
@@ -123,10 +123,8 @@ EXPORT_SYMBOL_GPL(mt7925_mcu_regval);int mt7925_mcu_update_arp_filter (struct mt76_dev *dev,struct ieee80211_bss_conf *link_conf) { -struct ieee80211_vif *mvif =container_of ((void *)link_conf->vif, - struct ieee80211_vif, - drv_priv);struct mt792x_bss_conf *mconf =mt792x_link_conf_to_mconf (link_conf); +struct ieee80211_vif *mvif = link_conf->vif;struct sk_buff *skb;int i, len =min_t (int, mvif->cfg.arp_addr_cnt,IEEE80211_BSS_ARP_ADDR_LIST_LEN );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/623 wifi: mt76: mt7996: fix overflows seen when writing limit attributes
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: xueqin Luo <[email protected]>
[ Upstream commit 5adbc8ce5bbe7e311e2600b7d7d998a958873e98 ]
DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large number such as 18446744073709551615 is provided by the user. Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations. This commit was inspired by commit: 57ee12b6c514.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +1 -1
@@ -82,7 +82,7 @@ static ssize_t mt7996_thermal_temp_store(struct device *dev,return ret;mutex_lock (&phy->dev->mt76.mutex); - val =clamp_val (DIV_ROUND_CLOSEST (val,1000 ),40 ,130 ); + val =DIV_ROUND_CLOSEST (clamp_val (val,40 *1000 ,130 *1000 ),1000 );/* add a safety margin ~10 */ if ((i - 1 == MT7996_CRIT_TEMP_IDX &&
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/623 wifi: mt76: mt7915: fix overflows seen when writing limit attributes
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: xueqin Luo <[email protected]>
[ Upstream commit 64d571742b0ae44eee5efd51e2d4a09d7f6782fc ]
DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large number such as 18446744073709551615 is provided by the user. Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations. This commit was inspired by commit: 57ee12b6c514.
--- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/init.c +1 -1
@@ -82,7 +82,7 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev,return ret;mutex_lock (&phy->dev->mt76.mutex); - val =clamp_val (DIV_ROUND_CLOSEST (val,1000 ),60 ,130 ); + val =DIV_ROUND_CLOSEST (clamp_val (val,60 *1000 ,130 *1000 ),1000 ); if ((i - 1 == MT7915_CRIT_TEMP_IDX && val > phy->throttle_temp[MT7915_MAX_TEMP_IDX]) ||
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/623 wifi: mt76: connac: Extend mt76_connac_mcu_uni_add_dev for MLO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Wang <[email protected]>
[ Upstream commit 9e4c3a007f01f567f2a8af35decd1e3c1c151c0f ]
This commit extends the mt76_connac_mcu_uni_add_dev function to include support for Multi-Link Operation (MLO). Additionally, backward compatibility for MT7921 is preserved, enabling seamless integration with existing setups.
--- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 1 + drivers/net/wireless/mediatek/mt76/mt7921/main.c | 1 + drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 +- drivers/net/wireless/mediatek/mt76/mt792x_core.c | 3 ++- 8 files changed, 11 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +1 -1
@@ -1113,7 +1113,7 @@ mt7615_mcu_uni_add_dev(struct mt7615_phy *phy, struct ieee80211_vif *vif, {struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv; -return mt76_connac_mcu_uni_add_dev (phy->mt76, &vif->bss_conf, +return mt76_connac_mcu_uni_add_dev (phy->mt76, &vif->bss_conf, &mvif->mt76, &mvif->sta.wcid, enable); }
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -1
@@ -1137,10 +1137,10 @@ EXPORT_SYMBOL_GPL(mt76_connac_mcu_wtbl_ba_tlv);int mt76_connac_mcu_uni_add_dev (struct mt76_phy *phy,struct ieee80211_bss_conf *bss_conf, +struct mt76_vif *mvif,struct mt76_wcid *wcid,bool enable) { -struct mt76_vif *mvif = (struct mt76_vif *)bss_conf->vif->drv_priv;struct mt76_dev *dev = phy->dev; struct { struct {
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -0
@@ -1938,6 +1938,7 @@ void mt76_connac_mcu_sta_ba_tlv(struct sk_buff *skb, bool enable, bool tx);int mt76_connac_mcu_uni_add_dev (struct mt76_phy *phy,struct ieee80211_bss_conf *bss_conf, +struct mt76_vif *mvif,struct mt76_wcid *wcid,bool enable); int mt76_connac_mcu_sta_ba(struct mt76_dev *dev, struct mt76_vif *mvif,
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -0
@@ -647,6 +647,7 @@ mt7921_vif_connect_iter(void *priv, u8 *mac,ieee80211_disconnect (vif, true);mt76_connac_mcu_uni_add_dev (&dev->mphy, &vif->bss_conf, + &mvif->bss_conf.mt76, &mvif->sta.deflink.wcid, true);mt7921_mcu_set_tx (dev, vif);
drivers/net/wireless/mediatek/mt76/mt7921/main.c +1 -0
@@ -308,6 +308,7 @@ mt7921_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->bss_conf.mt76.wmm_idx = mvif->bss_conf.mt76.idx %MT76_CONNAC_MAX_WMM_SETS ; ret =mt76_connac_mcu_uni_add_dev (&dev->mphy, &vif->bss_conf, + &mvif->bss_conf.mt76, &mvif->sta.deflink.wcid, true);if (ret) goto out;
drivers/net/wireless/mediatek/mt76/mt7925/mac.c +3 -1
@@ -1271,6 +1271,7 @@ mt7925_vif_connect_iter(void *priv, u8 *mac,struct mt792x_dev *dev = mvif->phy->dev;struct ieee80211_hw *hw =mt76_hw (dev);struct ieee80211_bss_conf *bss_conf; +struct mt792x_bss_conf *mconf;int i;if (vif->type ==NL80211_IFTYPE_STATION )
@@ -1278,8 +1279,9 @@ mt7925_vif_connect_iter(void *priv, u8 *mac,for_each_set_bit (i, &valid,IEEE80211_MLD_MAX_NUM_LINKS ) { bss_conf =mt792x_vif_to_bss_conf (vif, i); + mconf =mt792x_vif_to_link (mvif, i); -mt76_connac_mcu_uni_add_dev (&dev->mphy, bss_conf, +mt76_connac_mcu_uni_add_dev (&dev->mphy, bss_conf, &mconf->mt76, &mvif->sta.deflink.wcid, true);mt7925_mcu_set_tx (dev, bss_conf); }
drivers/net/wireless/mediatek/mt76/mt7925/main.c +1 -1
@@ -372,7 +372,7 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,else mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; - ret =mt76_connac_mcu_uni_add_dev (&dev->mphy, link_conf, + ret =mt76_connac_mcu_uni_add_dev (&dev->mphy, link_conf, &mconf->mt76, &mlink->wcid, true);if (ret) goto out;
drivers/net/wireless/mediatek/mt76/mt792x_core.c +2 -1
@@ -147,7 +147,8 @@ void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, link_conf =mt792x_vif_to_bss_conf (vif, mconf->link_id);mt76_connac_free_pending_tx_skbs (&dev->pm, &mlink->wcid); -mt76_connac_mcu_uni_add_dev (&dev->mphy, link_conf, &mlink->wcid, false); +mt76_connac_mcu_uni_add_dev (&dev->mphy, link_conf, &mconf->mt76, + &mlink->wcid, false);rcu_assign_pointer (dev->mt76.wcid[idx],NULL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/623 wifi: mt76: mt7925: Fix incorrect MLD address in bss_mld_tlv for MLO support
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 4d5427443595439c6cf5edfd9fb7224589f65b27 ]
For this TLV, the address should be set to the MLD address rather than the link address.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +2 -1
@@ -2459,6 +2459,7 @@ static void mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, struct ieee80211_bss_conf *link_conf) { + struct ieee80211_vif *vif = link_conf->vif;struct mt792x_bss_conf *mconf =mt792x_link_conf_to_mconf (link_conf);struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv;struct bss_mld_tlv *mld;
@@ -2479,7 +2480,7 @@ mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, mld->eml_enable = !!(link_conf->vif->cfg.eml_cap &IEEE80211_EML_CAP_EMLSR_SUPP ); -memcpy (mld->mac_addr, link_conf->addr,ETH_ALEN ); +memcpy (mld->mac_addr, vif->addr,ETH_ALEN ); } static void
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/623 wifi: mt76: mt7925: Fix incorrect WCID assignment for MLO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 4911e4cb157cf87d5bdb3fa8e0c200032443371e ]
For MLO, each link must have a corresponding WCID.
--- .../net/wireless/mediatek/mt76/mt7925/mac.c | 2 +- .../net/wireless/mediatek/mt76/mt7925/main.c | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mac.c +1 -1
@@ -49,7 +49,7 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev)break ; mlink =list_first_entry (&sta_poll_list, struct mt792x_link_sta, wcid.poll_list); - msta = container_of(mlink, struct mt792x_sta, deflink); + msta = mlink->sta;spin_lock_bh (&dev->mt76.sta_poll_lock);list_del_init (&mlink->wcid.poll_list);spin_unlock_bh (&dev->mt76.sta_poll_lock);
drivers/net/wireless/mediatek/mt76/mt7925/main.c +10 -9
@@ -837,6 +837,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,u8 link_id = link_sta->link_id;struct mt792x_link_sta *mlink;struct mt792x_sta *msta; +struct mt76_wcid *wcid;int ret, idx; msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
@@ -855,6 +856,15 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mlink->last_txs = jiffies; mlink->wcid.link_id = link_sta->link_id; mlink->wcid.link_valid = !!link_sta->sta->valid_links; + mlink->sta = msta; + + wcid = &mlink->wcid; +ewma_signal_init (&wcid->rssi); +rcu_assign_pointer (dev->mt76.wcid[wcid->idx], wcid); +mt76_wcid_init (wcid); +ewma_avg_signal_init (&mlink->avg_ack_signal); +memset (mlink->airtime_ac,0 , +sizeof (msta->deflink.airtime_ac)); ret =mt76_connac_pm_wake (&dev->mphy, &dev->pm);if (ret)
@@ -904,7 +914,6 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, struct ieee80211_sta *sta, unsigned long new_links) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; -struct mt76_wcid *wcid;unsigned int link_id;int err =0 ;
@@ -921,14 +930,6 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, err = -ENOMEM ;break ; } - - wcid = &mlink->wcid; -ewma_signal_init (&wcid->rssi); -rcu_assign_pointer (dev->mt76.wcid[wcid->idx], wcid); -mt76_wcid_init (wcid); -ewma_avg_signal_init (&mlink->avg_ack_signal); -memset (mlink->airtime_ac,0 , -sizeof (msta->deflink.airtime_ac)); } msta->valid_links |=BIT (link_id);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/623 wifi: mt76: mt7925: Fix incorrect WCID phy_idx assignment
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: allan.wang <[email protected]>
[ Upstream commit 4f741a2378b27a6be5e63b829cae4eb9cf2484e7 ]
Fix incorrect WCID phy_idx assignment.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +2 -2
@@ -384,7 +384,7 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,INIT_LIST_HEAD (&mlink->wcid.poll_list); mlink->wcid.idx = idx; - mlink->wcid.phy_idx = mconf->mt76.band_idx; + mlink->wcid.phy_idx =0 ; mlink->wcid.hw_key_idx =-1 ; mlink->wcid.tx_info |=MT_WCID_TX_INFO_SET ;mt76_wcid_init (&mlink->wcid);
@@ -851,7 +851,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev,INIT_LIST_HEAD (&mlink->wcid.poll_list); mlink->wcid.sta =1 ; mlink->wcid.idx = idx; - mlink->wcid.phy_idx = mconf->mt76.band_idx; + mlink->wcid.phy_idx =0 ; mlink->wcid.tx_info |=MT_WCID_TX_INFO_SET ; mlink->last_txs = jiffies; mlink->wcid.link_id = link_sta->link_id;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/623 wifi: mt76: mt7925: fix wrong parameter for related cmd of chan info
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 3f0d2178aaf1ed1c017e61cde9ce8a4432c804d1 ]
Fix incorrect parameters for the related channel information command.
--- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +21 -2
@@ -1198,6 +1198,8 @@ int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links, req.roc[i].bw_from_ap =CMD_CBW_20MHZ ; req.roc[i].center_chan = center_ch; req.roc[i].center_chan_from_ap = center_ch; + req.roc[i].center_chan2 =0 ; + req.roc[i].center_chan2_from_ap =0 ;/* STR : 0xfe indicates BAND_ALL with enabling DBDC * EMLSR : 0xff indicates (BAND_AUTO) without DBDC
@@ -2175,11 +2177,27 @@ void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy, req = (struct bss_rlm_tlv *)tlv; req->control_channel = chandef->chan->hw_value; req->center_chan =ieee80211_frequency_to_channel (freq1); - req->center_chan2 =ieee80211_frequency_to_channel (freq2); + req->center_chan2 =0 ; req->tx_streams =hweight8 (phy->antenna_mask); req->ht_op_info =4 ;/* set HT 40M allowed */ req->rx_streams =hweight8 (phy->antenna_mask); - req->band = band; + req->center_chan2 =0 ; + req->sco =0 ; + req->band =1 ; + +switch (band) { +case NL80211_BAND_2GHZ : + req->band =1 ; +break ; +case NL80211_BAND_5GHZ : + req->band =2 ; +break ; +case NL80211_BAND_6GHZ : + req->band =3 ; +break ; +default : +break ; + }switch (chandef->width) {case NL80211_CHAN_WIDTH_40 :
@@ -2190,6 +2208,7 @@ void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy,break ;case NL80211_CHAN_WIDTH_80P80 : req->bw =CMD_CBW_8080MHZ ; + req->center_chan2 =ieee80211_frequency_to_channel (freq2);break ;case NL80211_CHAN_WIDTH_160 : req->bw =CMD_CBW_160MHZ ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/623 wifi: mt76: mt7925: Fix CNM Timeout with Single Active Link in MLO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Yen <[email protected]>
[ Upstream commit 4a596010b246816d7589d8d775b83833a59e63f9 ]
Fix CNM command timeout issue when only a single active link is available during MLO connection to fix the following kernel log error.
[ 741.931030] wlan0: [link 1] local address be:90:e0:22:c4:22, AP link address 08:0c:43:7a:19:2a [ 741.931042] wlan0: [link 1] determined AP 08:0c:43:7a:19:2a to be EHT [ 741.931052] wlan0: [link 1] connecting with EHT mode, max bandwidth 160 MHz [ 741.931071] wlan0: WMM AC=0 acm=0 aifs=2 cWmin=3 cWmax=7 txop=47 uapsd=0, downgraded=0 [ 741.931076] wlan0: WMM AC=1 acm=0 aifs=2 cWmin=7 cWmax=15 txop=94 uapsd=0, downgraded=0 [ 741.931080] wlan0: WMM AC=2 acm=0 aifs=3 cWmin=15 cWmax=1023 txop=0 uapsd=0, downgraded=0 [ 741.931085] wlan0: WMM AC=3 acm=0 aifs=7 cWmin=15 cWmax=1023 txop=0 uapsd=0, downgraded=0 [ 741.931095] wlan0: moving STA 22:0c:43:7a:19:2a to state 3 [ 749.090928] mt7925e 0000:2b:00.0: Message 00020002 (seq 15) timeout [ 752.162972] mt7925e 0000:2b:00.0: Message 00020003 (seq 1) timeout [ 755.234975] mt7925e 0000:2b:00.0: Message 00020002 (seq 2) timeout [ 758.306971] mt7925e 0000:2b:00.0: Message 00020004 (seq 3) timeout
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +6 -1
@@ -1151,7 +1151,12 @@ int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links,u8 rsv[4 ]; }__packed hdr;struct roc_acquire_tlv roc[2 ]; - }__packed req; + }__packed req = { + .roc[0 ].tag =cpu_to_le16 (UNI_ROC_NUM ), + .roc[0 ].len =cpu_to_le16 (sizeof (struct roc_acquire_tlv )), + .roc[1 ].tag =cpu_to_le16 (UNI_ROC_NUM ), + .roc[1 ].len =cpu_to_le16 (sizeof (struct roc_acquire_tlv )) + };if (!mconf ||hweight16 (vif->valid_links) <2 ||hweight16 (sel_links) !=2 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/623 wifi: mt76: mt7925: Enhance mt7925_mac_link_bss_add to support MLO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit ac03e5b82bc6b44e8ea3e7c7c624ee1445ff4e4b ]
In mt7925_mac_link_bss_add(), the mt76_connac_mcu_uni_add_dev() function must be executed only after all parameters have been properly initialized.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +8 -6
@@ -365,18 +365,14 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev, mconf->mt76.omac_idx =ieee80211_vif_is_mld (vif) ?0 : mconf->mt76.idx; mconf->mt76.band_idx =0xff ; - mconf->mt76.wmm_idx = mconf->mt76.idx %MT76_CONNAC_MAX_WMM_SETS ; + mconf->mt76.wmm_idx =ieee80211_vif_is_mld (vif) ? +0 : mconf->mt76.idx %MT76_CONNAC_MAX_WMM_SETS ;if (mvif->phy->mt76->chandef.chan->band !=NL80211_BAND_2GHZ ) mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL +4 ;else mconf->mt76.basic_rates_idx = MT792x_BASIC_RATES_TBL; - ret =mt76_connac_mcu_uni_add_dev (&dev->mphy, link_conf, &mconf->mt76, - &mlink->wcid, true); -if (ret) - goto out; - dev->mt76.vif_mask |=BIT_ULL (mconf->mt76.idx); mvif->phy->omac_mask |=BIT_ULL (mconf->mt76.omac_idx);
@@ -395,6 +391,12 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,ewma_rssi_init (&mconf->rssi);rcu_assign_pointer (dev->mt76.wcid[idx], &mlink->wcid); + + ret =mt76_connac_mcu_uni_add_dev (&dev->mphy, link_conf, &mconf->mt76, + &mlink->wcid, true); +if (ret) + goto out; +if (vif->txq) { mtxq = (struct mt76_txq *)vif->txq->drv_priv; mtxq->wcid = idx;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/623 wifi: mt76: Enhance mt7925_mac_link_sta_add to support MLO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit e6803d39a8aa59e557402a541a97ee04b06c49b2 ]
Enhance mt7925_mac_link_sta_add to support MLO.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +8 -3
@@ -878,9 +878,14 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, link_conf =mt792x_vif_to_bss_conf (vif, link_id);/* should update bss info before STA add */ -if (vif->type ==NL80211_IFTYPE_STATION && !link_sta->sta->tdls) -mt7925_mcu_add_bss_info (&dev->phy, mconf->mt76.ctx, - link_conf, link_sta, false); +if (vif->type ==NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { +if (ieee80211_vif_is_mld (vif)) +mt7925_mcu_add_bss_info (&dev->phy, mconf->mt76.ctx, + link_conf, link_sta, link_sta != mlink->pri_link); +else +mt7925_mcu_add_bss_info (&dev->phy, mconf->mt76.ctx, + link_conf, link_sta, false); + }if (ieee80211_vif_is_mld (vif) && link_sta == mlink->pri_link) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/623 wifi: mt76: mt7925: Update mt7925_mcu_sta_update for BC in ASSOC state
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 0e02f6ed6a49577e29e0b1f7900fad3ed8ae870c ]
Update mt7925_mcu_sta_update for broadcast (BC) in the ASSOC state.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +5 -1
@@ -1903,7 +1903,11 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, mlink =mt792x_sta_to_link (msta, link_sta->link_id); } info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid; - info.newly = link_sta ? state !=MT76_STA_INFO_STATE_ASSOC : true; + +if (link_sta) + info.newly = state !=MT76_STA_INFO_STATE_ASSOC ; +else + info.newly = state ==MT76_STA_INFO_STATE_ASSOC ? false : true;if (ieee80211_vif_is_mld (vif)) err =mt7925_mcu_mlo_sta_cmd (&dev->mphy, &info);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/623 wifi: mt76: mt7925: Update mt792x_rx_get_wcid for per-link STA
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 90c10286b176421068b136da51ed83059a68e322 ]
Update mt792x_rx_get_wcid to support per-link STA.
--- drivers/net/wireless/mediatek/mt76/mt792x_mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt792x_mac.c +1 -1
@@ -153,7 +153,7 @@ struct mt76_wcid *mt792x_rx_get_wcid(struct mt792x_dev *dev, u16 idx,return NULL ; link = container_of(wcid, struct mt792x_link_sta, wcid); - sta = container_of(link, struct mt792x_sta, deflink); + sta = link->sta;if (!sta->vif)return NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/623 wifi: mt76: mt7925: Update mt7925_unassign_vif_chanctx for per-link BSS
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 30b721467c9c2510e26af6e78e92d7cc08a14bc4 ]
Update mt7925_unassign_vif_chanctx to support per-link BSS.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +1 -3
@@ -2081,18 +2081,16 @@ static void mt7925_unassign_vif_chanctx(struct ieee80211_hw *hw,struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv;struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;struct mt792x_dev *dev =mt792x_hw_dev (hw); -struct ieee80211_bss_conf *pri_link_conf;struct mt792x_bss_conf *mconf;mutex_lock (&dev->mt76.mutex);if (ieee80211_vif_is_mld (vif)) { mconf =mt792x_vif_to_link (mvif, link_conf->link_id); - pri_link_conf =mt792x_vif_to_bss_conf (vif, mvif->deflink_id);if (vif->type ==NL80211_IFTYPE_STATION && mconf == &mvif->bss_conf) -mt7925_mcu_add_bss_info (&dev->phy,NULL , pri_link_conf, +mt7925_mcu_add_bss_info (&dev->phy,NULL , link_conf,NULL , false); }else { mconf = &mvif->bss_conf;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/623 wifi: mt76: mt7925: Update secondary link PS flow
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 8dafab9c4116a6a4fd870be03a3d9b66771dc5a8 ]
Update the power-saving flow for secondary links.
--- .../net/wireless/mediatek/mt76/mt7925/main.c | 7 ++++++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 25 ++++++------------- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +++ drivers/net/wireless/mediatek/mt76/mt792x.h | 7 ++++-- 4 files changed, 22 insertions(+), 20 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +7 -0
@@ -1903,6 +1903,13 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw,if (changed & (BSS_CHANGED_QOS |BSS_CHANGED_BEACON_ENABLED ))mt7925_mcu_set_tx (dev, info); +if (changed &BSS_CHANGED_BSSID ) { +if (ieee80211_vif_is_mld (vif) && +hweight16 (mvif->valid_links) ==2 ) +/* Indicate the secondary setup done */ +mt7925_mcu_uni_bss_bcnft (dev, info, true); + } +mt792x_mutex_release (dev); }
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +7 -18
@@ -1362,7 +1362,7 @@ int mt7925_mcu_uni_bss_ps(struct mt792x_dev *dev, &ps_req, sizeof(ps_req), true); } -static int +int mt7925_mcu_uni_bss_bcnft (struct mt792x_dev *dev,struct ieee80211_bss_conf *link_conf,bool enable) {
@@ -1923,32 +1923,21 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, {#define MT7925_FIF_BIT_CLR BIT(1)#define MT7925_FIF_BIT_SET BIT(0) -struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; -unsigned long valid =ieee80211_vif_is_mld (vif) ? - mvif->valid_links :BIT (0 ); -struct ieee80211_bss_conf *bss_conf;int err =0 ; -int i;if (enable) { -for_each_set_bit (i, &valid,IEEE80211_MLD_MAX_NUM_LINKS ) { - bss_conf =mt792x_vif_to_bss_conf (vif, i); - err =mt7925_mcu_uni_bss_bcnft (dev, bss_conf, true); -if (err <0 ) -return err; - } + err =mt7925_mcu_uni_bss_bcnft (dev, &vif->bss_conf, true); +if (err <0 ) +return err;return mt7925_mcu_set_rxfilter (dev,0 ,MT7925_FIF_BIT_SET ,MT_WF_RFCR_DROP_OTHER_BEACON ); } -for_each_set_bit (i, &valid,IEEE80211_MLD_MAX_NUM_LINKS ) { - bss_conf =mt792x_vif_to_bss_conf (vif, i); - err =mt7925_mcu_set_bss_pm (dev, bss_conf, false); -if (err) -return err; - } + err =mt7925_mcu_set_bss_pm (dev, &vif->bss_conf, false); +if (err <0 ) +return err; return mt7925_mcu_set_rxfilter(dev, 0, MT7925_FIF_BIT_CLR,
drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +3 -0
@@ -643,4 +643,7 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif,int mt7925_mcu_set_rate_txpower (struct mt76_phy *phy);int mt7925_mcu_update_arp_filter (struct mt76_dev *dev,struct ieee80211_bss_conf *link_conf); +int +mt7925_mcu_uni_bss_bcnft (struct mt792x_dev *dev, +struct ieee80211_bss_conf *link_conf,bool enable);#endif
drivers/net/wireless/mediatek/mt76/mt792x.h +5 -2
@@ -241,6 +241,7 @@ static inline struct mt792x_bss_conf * mt792x_vif_to_link(struct mt792x_vif *mvif, u8 link_id) {struct ieee80211_vif *vif; +struct mt792x_bss_conf *bss_conf; vif = container_of((void *)mvif, struct ieee80211_vif, drv_priv);
@@ -248,8 +249,10 @@ mt792x_vif_to_link(struct mt792x_vif *mvif, u8 link_id) link_id >= IEEE80211_LINK_UNSPECIFIED)return &mvif->bss_conf; -return rcu_dereference_protected (mvif->link_conf[link_id], -lockdep_is_held (&mvif->phy->dev->mt76.mutex)); + bss_conf =rcu_dereference_protected (mvif->link_conf[link_id], +lockdep_is_held (&mvif->phy->dev->mt76.mutex)); + +return bss_conf ? bss_conf : &mvif->bss_conf; } static inline struct mt792x_link_sta *
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/623 wifi: mt76: mt7925: Init secondary link PM state
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 28045ef2bc5bbeec4717da98bf31aca0faaccf02 ]
Initialize secondary link PM state.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +2 -0
@@ -1991,6 +1991,8 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto free;if (mconf != &mvif->bss_conf) { +mt7925_mcu_set_bss_pm (dev, link_conf, true); + err =mt7925_set_mlo_roc (phy, &mvif->bss_conf, vif->active_links);if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 200/623 wifi: mt76: mt7925: Update mt7925_mcu_uni_[tx,rx]_ba for MLO
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit eb2a9a12c6092a26f632468d6610497d4f0e40da ]
Update mt7925_mcu_uni_[tx,rx]_ba for MLO support in firmware.
--- .../net/wireless/mediatek/mt76/mt7925/main.c | 10 ++-- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 50 +++++++++++++++---- .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 + 3 files changed, 48 insertions(+), 14 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +5 -5
@@ -1258,22 +1258,22 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,case IEEE80211_AMPDU_RX_START :mt76_rx_aggr_start (&dev->mt76, &msta->deflink.wcid, tid, ssn, params->buf_size); -mt7925_mcu_uni_rx_ba (dev, params, true); +mt7925_mcu_uni_rx_ba (dev, vif, params, true);break ;case IEEE80211_AMPDU_RX_STOP :mt76_rx_aggr_stop (&dev->mt76, &msta->deflink.wcid, tid); -mt7925_mcu_uni_rx_ba (dev, params, false); +mt7925_mcu_uni_rx_ba (dev, vif, params, false);break ;case IEEE80211_AMPDU_TX_OPERATIONAL : mtxq->aggr = true; mtxq->send_bar = false; -mt7925_mcu_uni_tx_ba (dev, params, true); +mt7925_mcu_uni_tx_ba (dev, vif, params, true);break ;case IEEE80211_AMPDU_TX_STOP_FLUSH :case IEEE80211_AMPDU_TX_STOP_FLUSH_CONT : mtxq->aggr = false;clear_bit (tid, &msta->deflink.wcid.ampdu_state); -mt7925_mcu_uni_tx_ba (dev, params, false); +mt7925_mcu_uni_tx_ba (dev, vif, params, false);break ;case IEEE80211_AMPDU_TX_START :set_bit (tid, &msta->deflink.wcid.ampdu_state);
@@ -1282,7 +1282,7 @@ mt7925_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif,case IEEE80211_AMPDU_TX_STOP_CONT : mtxq->aggr = false;clear_bit (tid, &msta->deflink.wcid.ampdu_state); -mt7925_mcu_uni_tx_ba (dev, params, false); +mt7925_mcu_uni_tx_ba (dev, vif, params, false);ieee80211_stop_tx_ba_cb_irqsafe (vif, sta->addr, tid);break ; }
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +41 -9
79 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +2 -0
@@ -242,9 +242,11 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev,struct ieee80211_vif *vif, bool enable);int mt7925_mcu_uni_tx_ba (struct mt792x_dev *dev, +struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params,bool enable);int mt7925_mcu_uni_rx_ba (struct mt792x_dev *dev, +struct ieee80211_vif *vif,struct ieee80211_ampdu_params *params,bool enable);void mt7925_scan_work (struct work_struct *work);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/623 wifi: mt76: mt7925: Cleanup MLO settings post-disconnection
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 816161051a039eeb1226fc85e2b38389f508906c ]
Clean up MLO settings after disconnection.
--- .../net/wireless/mediatek/mt76/mt7925/main.c | 37 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 4 +- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 2 +- 3 files changed, 38 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +35 -2
@@ -1149,8 +1149,7 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,struct mt792x_bss_conf *mconf; mconf =mt792x_link_conf_to_mconf (link_conf); -mt7925_mcu_add_bss_info (&dev->phy, mconf->mt76.ctx, link_conf, - link_sta, false); +mt792x_mac_link_bss_remove (dev, mconf, mlink); }spin_lock_bh (&mdev->sta_poll_lock);
@@ -1208,12 +1207,46 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; +struct { +struct { +u8 omac_idx; +u8 band_idx; +__le16 pad; + } __packed hdr; +struct req_tlv { +__le16 tag; +__le16 len; +u8 active; +u8 link_idx;/* hw link idx */ +u8 omac_addr[ETH_ALEN ]; + } __packed tlv; + } dev_req = { + .hdr = { + .omac_idx =0 , + .band_idx =0 , + }, + .tlv = { + .tag =cpu_to_le16 (DEV_INFO_ACTIVE ), + .len =cpu_to_le16 (sizeof (struct req_tlv )), + .active = true, + }, + };unsigned long rem; rem =ieee80211_vif_is_mld (vif) ? msta->valid_links :BIT (0 );mt7925_mac_sta_remove_links (dev, vif, sta, rem); +if (ieee80211_vif_is_mld (vif)) { +mt7925_mcu_set_dbdc (&dev->mphy, false); + +/* recovery omac address for the legacy interface */ +memcpy (dev_req.tlv.omac_addr, vif->addr,ETH_ALEN ); +mt76_mcu_send_msg (mdev,MCU_UNI_CMD (DEV_INFO_UPDATE ), + &dev_req,sizeof (dev_req), true); + + } +if (vif->type ==NL80211_IFTYPE_STATION ) {struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +2 -2
@@ -2660,7 +2660,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, MCU_UNI_CMD(BSS_INFO_UPDATE), true); } -int mt7925_mcu_set_dbdc (struct mt76_phy *phy) +int mt7925_mcu_set_dbdc (struct mt76_phy *phy,bool enable) {struct mt76_dev *mdev = phy->dev;
@@ -2680,7 +2680,7 @@ int mt7925_mcu_set_dbdc(struct mt76_phy *phy) tlv =mt76_connac_mcu_add_tlv (skb,UNI_MBMC_SETTING ,sizeof (*conf)); conf = (struct mbmc_conf_tlv *)tlv; - conf->mbmc_en =1 ; + conf->mbmc_en = enable; conf->band =0 ;/* unused */ err = mt76_mcu_skb_send_msg(mdev, skb, MCU_UNI_CMD(SET_DBDC_PARMS),
drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +1 -1
@@ -616,7 +616,7 @@ mt7925_mcu_get_cipher(int cipher) } } -int mt7925_mcu_set_dbdc (struct mt76_phy *phy); +int mt7925_mcu_set_dbdc (struct mt76_phy *phy,bool enable);int mt7925_mcu_hw_scan (struct mt76_phy *phy,struct ieee80211_vif *vif,struct ieee80211_scan_request *scan_req); int mt7925_mcu_cancel_hw_scan(struct mt76_phy *phy,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/623 wifi: mt76: mt7925: Properly handle responses for commands with events
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Yen Hsieh <[email protected]>
[ Upstream commit 349460913a4d029cc37c9e3817b1903233b4a627 ]
Properly retrieve the response for commands with events. Ensure accurate handling of event-driven commands.
--- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 1 - drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/main.c +0 -1
@@ -1244,7 +1244,6 @@ void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,memcpy (dev_req.tlv.omac_addr, vif->addr,ETH_ALEN );mt76_mcu_send_msg (mdev,MCU_UNI_CMD (DEV_INFO_UPDATE ), &dev_req,sizeof (dev_req), true); - }if (vif->type ==NL80211_IFTYPE_STATION ) {
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +5 -5
@@ -1252,7 +1252,7 @@ int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links, }return mt76_mcu_send_msg (&mvif->phy->dev->mt76,MCU_UNI_CMD (ROC ), - &req,sizeof (req), false); + &req,sizeof (req), true); } int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
@@ -1301,7 +1301,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, }return mt76_mcu_send_msg (&dev->mt76,MCU_UNI_CMD (ROC ), - &req,sizeof (req), false); + &req,sizeof (req), true); } int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf,
@@ -1331,7 +1331,7 @@ int mt7925_mcu_abort_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, };return mt76_mcu_send_msg (&dev->mt76,MCU_UNI_CMD (ROC ), - &req,sizeof (req), false); + &req,sizeof (req), true); }int mt7925_mcu_set_eeprom (struct mt792x_dev *dev)
@@ -1484,12 +1484,12 @@ mt7925_mcu_set_bss_pm(struct mt792x_dev *dev,int err; err =mt76_mcu_send_msg (&dev->mt76,MCU_UNI_CMD (BSS_INFO_UPDATE ), - &req1,sizeof (req1), false); + &req1,sizeof (req1), true);if (err <0 || !enable)return err;return mt76_mcu_send_msg (&dev->mt76,MCU_UNI_CMD (BSS_INFO_UPDATE ), - &req,sizeof (req), false); + &req,sizeof (req), true); } static void
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/623 wifi: mt76: mt7996: fix rx filter setting for bfee functionality
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 858fd2a53877b2e8b1d991a5a861ac34a0f55ef8 ]
Fix rx filter setting to prevent dropping NDPA frames. Without this change, bfee functionality may behave abnormally.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +1 -2
@@ -496,8 +496,7 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,MT76_FILTER (CONTROL ,MT_WF_RFCR_DROP_CTS |MT_WF_RFCR_DROP_RTS | -MT_WF_RFCR_DROP_CTL_RSV | -MT_WF_RFCR_DROP_NDPA ); +MT_WF_RFCR_DROP_CTL_RSV ); *total_flags = flags;mt76_wr (dev,MT_WF_RFCR (phy->mt76->band_idx), phy->rxfilter);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/623 wifi: mt76: only enable tx worker after setting the channel
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 228bc0e79c85269d36cc81e0288e95f2f9ba7ae1 ]
Avoids sending packets too early
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +1 -1
@@ -958,11 +958,11 @@ int mt76_set_channel(struct mt76_phy *phy, struct cfg80211_chan_def *chandef,if (chandef->chan != phy->main_chan)memset (phy->chan_state,0 ,sizeof (*phy->chan_state)); -mt76_worker_enable (&dev->tx_worker); ret = dev->drv->set_channel (phy);clear_bit (MT76_RESET , &phy->state); +mt76_worker_enable (&dev->tx_worker);mt76_worker_schedule (&dev->tx_worker);mutex_unlock (&dev->mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/623 wifi: mt76: mt7915: firmware restart on devices with a second pcie link
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit 9b60e2ae511c959024ecf6578b3fbe85cd06d7cc ]
It seems that the firmware checks the register used for detecting matching PCIe links in order to figure out if a secondary PCIe link is enabled. Write the register again just before starting the firmware on hw reset, in order to fix an issue that left the second band unusable after restart.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 ++ drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 1 + drivers/net/wireless/mediatek/mt76/mt7915/pci.c | 1 + 3 files changed, 4 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +2 -0
@@ -1388,6 +1388,8 @@ mt7915_mac_restart(struct mt7915_dev *dev)if (dev_is_pci (mdev->dev)) {mt76_wr (dev,MT_PCIE_MAC_INT_ENABLE ,0xff );if (dev->hif2) { +mt76_wr (dev,MT_PCIE_RECOG_ID , + dev->hif2->index |MT_PCIE_RECOG_ID_SEM );if (is_mt7915 (mdev))mt76_wr (dev,MT_PCIE1_MAC_INT_ENABLE ,0xff );else
drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +1 -0
@@ -191,6 +191,7 @@ struct mt7915_hif {struct device *dev;void __iomem *regs;int irq; +u32 index; };struct mt7915_phy {
drivers/net/wireless/mediatek/mt76/mt7915/pci.c +1 -0
@@ -42,6 +42,7 @@ static struct mt7915_hif *mt7915_pci_get_hif2(u32 idx)continue ;get_device (hif->dev); + hif->index = idx; goto out; } hif =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/623 wifi: mt76: mt7915: fix omac index assignment after hardware reset
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Fietkau <[email protected]>
[ Upstream commit cd043bbba6f9b71ebe0781d1bd2107565363c4b9 ]
Reset per-phy mac address slot mask in order to avoid leaking entries.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +5 -0
@@ -1444,9 +1444,11 @@ static void mt7915_mac_full_reset(struct mt7915_dev *dev) {struct mt76_phy *ext_phy; +struct mt7915_phy *phy2;int i; ext_phy = dev->mt76.phys[MT_BAND1 ]; + phy2 = ext_phy ? ext_phy->priv :NULL ; dev->recovery.hw_full_reset = true;
@@ -1476,6 +1478,9 @@ mt7915_mac_full_reset(struct mt7915_dev *dev)memset (dev->mt76.wcid_mask,0 ,sizeof (dev->mt76.wcid_mask)); dev->mt76.vif_mask =0 ; + dev->phy.omac_mask =0 ; +if (phy2) + phy2->omac_mask =0 ; i =mt76_wcid_alloc (dev->mt76.wcid_mask,MT7915_WTBL_STA ); dev->mt76.global_wcid.idx = i;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/623 wifi: mt76: mt7915: fix register mapping
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chiu <[email protected]>
[ Upstream commit dd1649ef966bb87053c17385ea2cfd1758f5385b ]
Bypass the entry when ofs is equal to dev->reg.map[i].size. Without this patch, it would get incorrect register mapping when the CR address is located at the boundary of an entry.
--- drivers/net/wireless/mediatek/mt76/mt7915/mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +1 -1
@@ -484,7 +484,7 @@ static u32 __mt7915_reg_addr(struct mt7915_dev *dev, u32 addr)continue ; ofs = addr - dev->reg.map[i].phys; -if (ofs > dev->reg.map[i].size) +if (ofs >= dev->reg.map[i].size)continue ;return dev->reg.map[i].maps + ofs;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/623 wifi: mt76: mt7996: fix register mapping
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chiu <[email protected]>
[ Upstream commit d07ecb4f7070e84de49e8fa4e5a83dd52716d805 ]
Bypass the entry when ofs is equal to dev->reg.map[i].size. Without this patch, it would get incorrect register mapping when the CR address is located at the boundary of an entry.
--- drivers/net/wireless/mediatek/mt76/mt7996/mmio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +1 -1
@@ -177,7 +177,7 @@ static u32 __mt7996_reg_addr(struct mt7996_dev *dev, u32 addr)continue ; ofs = addr - dev->reg.map[i].phys; -if (ofs > dev->reg.map[i].size) +if (ofs >= dev->reg.map[i].size)continue ;return dev->reg.map[i].mapped + ofs;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/623 wifi: mt76: mt7996: add max mpdu len capability
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chiu <[email protected]>
[ Upstream commit 1816ad9381e0c150e4c44ce6dd6ee2c52008a052 ]
Set max mpdu len to 11454 according to hardware capability. Without this patch, the max ampdu length would be 3895 and count not get expected performance.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +3 -1
@@ -1187,7 +1187,9 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band, eht_cap_elem->mac_cap_info[0 ] =IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS | -IEEE80211_EHT_MAC_CAP0_OM_CONTROL ; +IEEE80211_EHT_MAC_CAP0_OM_CONTROL | +u8_encode_bits (IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454 , +IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK ); eht_cap_elem->phy_cap_info[0 ] = IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/623 wifi: mt76: mt7996: fix the capability of reception of EHT MU PPDU
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Howard Hsu <[email protected]>
[ Upstream commit 2ffbdfc1bd78ba944c5754791c84f32232b513c6 ]
This commit includes two changes. First, enable "EHT MU PPDU With 4x EHT-LTF And 0.8us GI" in EHT Phy capabilities element since hardware can support. Second, fix the value of "Maximum number of supported EHT LTFs" in the same element, where the previous setting of 3 in Bit 3-4 was incorrect.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +2 -3
@@ -1232,21 +1232,20 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band,IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK ; eht_cap_elem->phy_cap_info[4 ] = +IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI |u8_encode_bits (min_t (int, sts -1 ,2 ),IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK ); eht_cap_elem->phy_cap_info[5 ] =u8_encode_bits (IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US ,IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK ) | -u8_encode_bits (u8_get_bits (0x11 ,GENMASK (1 ,0 )), +u8_encode_bits (u8_get_bits (1 ,GENMASK (1 ,0 )),IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK ); val = width ==NL80211_CHAN_WIDTH_320 ?0xf : width ==NL80211_CHAN_WIDTH_160 ?0x7 : width ==NL80211_CHAN_WIDTH_80 ?0x3 :0x1 ; eht_cap_elem->phy_cap_info[6 ] = -u8_encode_bits (u8_get_bits (0x11 ,GENMASK (4 ,2 )), -IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK ) |u8_encode_bits (val,IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK ); val = u8_encode_bits(nss, IEEE80211_EHT_MCS_NSS_RX) |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/623 wifi: mt76: mt7996: fix HE Phy capability
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Howard Hsu <[email protected]>
[ Upstream commit 7e3aef59a403ade5dd4ea02edc2d7138a66d74b6 ]
Set HE SU PPDU And HE MU PPDU With 4x HE-LTF And 0.8 us GI within HE PHY Capabilities element as 1 since hardware can support.
--- drivers/net/wireless/mediatek/mt76/mt7996/init.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/init.c +4 -2
@@ -1077,6 +1077,9 @@ mt7996_init_he_caps(struct mt7996_phy *phy, enum nl80211_band band, he_cap_elem->phy_cap_info[2 ] =IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ |IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ ; + he_cap_elem->phy_cap_info[7 ] = +IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI ; +switch (iftype) {case NL80211_IFTYPE_AP : he_cap_elem->mac_cap_info[0 ] |=IEEE80211_HE_MAC_CAP0_TWT_RES ;
@@ -1116,8 +1119,7 @@ mt7996_init_he_caps(struct mt7996_phy *phy, enum nl80211_band band,IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE |IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT ; he_cap_elem->phy_cap_info[7 ] |= -IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | -IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI ; +IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP ; he_cap_elem->phy_cap_info[8 ] |=IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU |
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/623 wifi: mt76: mt7996: fix incorrect indexing of MIB FW event
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Lin <[email protected]>
[ Upstream commit 5c2a25a1ab76a2976dddc5ffd58498866f3ef7c2 ]
Fix wrong calculation of the channel times due to incorrect interpretation from the FW event.
--- .../net/wireless/mediatek/mt76/mt7996/mcu.c | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +29 -16
@@ -3666,6 +3666,13 @@ int mt7996_mcu_get_chip_config(struct mt7996_dev *dev, u32 *cap) int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch) { + enum { + IDX_TX_TIME, + IDX_RX_TIME, + IDX_OBSS_AIRTIME, + IDX_NON_WIFI_TIME, + IDX_NUM + }; struct { struct { u8 band;
@@ -3675,16 +3682,15 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch)__le16 tag;__le16 len;__le32 offs; - } data[4 ]; + } data[IDX_NUM ]; }__packed req = { .hdr.band = phy->mt76->band_idx, }; -/* strict order */ static const u32 offs[] = { -UNI_MIB_TX_TIME , -UNI_MIB_RX_TIME , -UNI_MIB_OBSS_AIRTIME , -UNI_MIB_NON_WIFI_TIME , + [IDX_TX_TIME ] =UNI_MIB_TX_TIME , + [IDX_RX_TIME ] =UNI_MIB_RX_TIME , + [IDX_OBSS_AIRTIME ] =UNI_MIB_OBSS_AIRTIME , + [IDX_NON_WIFI_TIME ] =UNI_MIB_NON_WIFI_TIME , };struct mt76_channel_state *state = phy->mt76->chan_state;struct mt76_channel_state *state_ts = &phy->state_ts;
@@ -3693,7 +3699,7 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch)struct sk_buff *skb;int i, ret; -for (i =0 ; i <4 ; i++) { +for (i =0 ; i <IDX_NUM ; i++) { req.data[i].tag =cpu_to_le16 (UNI_CMD_MIB_DATA ); req.data[i].len =cpu_to_le16 (sizeof (req.data[i])); req.data[i].offs =cpu_to_le32 (offs[i]);
@@ -3712,17 +3718,24 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch) goto out;#define __res_u64 (s) le64_to_cpu(res[s].data) - state->cc_tx +=__res_u64 (1 ) - state_ts->cc_tx; - state->cc_bss_rx +=__res_u64 (2 ) - state_ts->cc_bss_rx; - state->cc_rx +=__res_u64 (2 ) +__res_u64 (3 ) - state_ts->cc_rx; - state->cc_busy +=__res_u64 (0 ) +__res_u64 (1 ) +__res_u64 (2 ) +__res_u64 (3 ) - + state->cc_tx +=__res_u64 (IDX_TX_TIME ) - state_ts->cc_tx; + state->cc_bss_rx +=__res_u64 (IDX_RX_TIME ) - state_ts->cc_bss_rx; + state->cc_rx +=__res_u64 (IDX_RX_TIME ) + +__res_u64 (IDX_OBSS_AIRTIME ) - + state_ts->cc_rx; + state->cc_busy +=__res_u64 (IDX_TX_TIME ) + +__res_u64 (IDX_RX_TIME ) + +__res_u64 (IDX_OBSS_AIRTIME ) + +__res_u64 (IDX_NON_WIFI_TIME ) - state_ts->cc_busy; - out: - state_ts->cc_tx =__res_u64 (1 ); - state_ts->cc_bss_rx =__res_u64 (2 ); - state_ts->cc_rx =__res_u64 (2 ) +__res_u64 (3 ); - state_ts->cc_busy =__res_u64 (0 ) +__res_u64 (1 ) +__res_u64 (2 ) +__res_u64 (3 ); + state_ts->cc_tx =__res_u64 (IDX_TX_TIME ); + state_ts->cc_bss_rx =__res_u64 (IDX_RX_TIME ); + state_ts->cc_rx =__res_u64 (IDX_RX_TIME ) +__res_u64 (IDX_OBSS_AIRTIME ); + state_ts->cc_busy =__res_u64 (IDX_TX_TIME ) + +__res_u64 (IDX_RX_TIME ) + +__res_u64 (IDX_OBSS_AIRTIME ) + +__res_u64 (IDX_NON_WIFI_TIME );#undef __res_u64dev_kfree_skb (skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/623 wifi: mt76: mt7996: fix definition of tx descriptor
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Lin <[email protected]>
[ Upstream commit 14749fe2ed360c92c1a2a76dac0b77f759234981 ]
For mt7992 chipsets, the definition of TXD.DW6.BIT10~15 has different interpretations on different frame types. Driver only needs to fill MSDU_CNT for non-management frames.
--- drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +3 -2
@@ -819,6 +819,7 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, struct ieee80211_key_conf *key, int pid, enum mt76_txq_id qid, u32 changed) { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_vif *vif = info->control.vif;u8 band_idx = (info->hw_queue &MT_TX_HW_QUEUE_PHY ) >>2 ;
@@ -886,8 +887,9 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi, val =MT_TXD6_DIS_MAT |MT_TXD6_DAS ;if (is_mt7996 (&dev->mt76)) val |=FIELD_PREP (MT_TXD6_MSDU_CNT ,1 ); -else +else if (is_8023 || !ieee80211_is_mgmt (hdr->frame_control)) val |=FIELD_PREP (MT_TXD6_MSDU_CNT_V2 ,1 ); + txwi[6 ] =cpu_to_le32 (val); txwi[7 ] =0 ;
@@ -897,7 +899,6 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,mt7996_mac_write_txwi_80211 (dev, txwi, skb, key);if (txwi[1 ] &cpu_to_le32 (MT_TXD1_FIXED_RATE )) { -struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;bool mcast =ieee80211_is_data (hdr->frame_control) &&is_multicast_ether_addr (hdr->addr1);u8 idx =MT7996_BASIC_RATES_TBL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/623 wifi: mt76: mt7996: fix ldpc setting
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Chiu <[email protected]>
[ Upstream commit da8352da1e4f476fdbf549a4efce4f3c618fde3b ]
The non-AP interfaces would not use conf->vht_ldpc so they never set STA_CAP_VHT_LDPC even if peer-station support LDPC.
Check conf->vht_ldpc only for AP interface.
Without this patch, station only uses BCC to transmit packet in VHT mode.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1 -1
@@ -2070,7 +2070,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, cap |=STA_CAP_VHT_TX_STBC ;if (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_RXSTBC_1 ) cap |=STA_CAP_VHT_RX_STBC ; -if (vif->bss_conf.vht_ldpc && +if ((vif->type !=NL80211_IFTYPE_AP || vif->bss_conf.vht_ldpc) && (sta->deflink.vht_cap.cap &IEEE80211_VHT_CAP_RXLDPC )) cap |=STA_CAP_VHT_LDPC ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/623 i2c: designware: Actually make use of the I2C_DW_COMMON and I2C_DW symbol namespaces
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit f0a4e9fa656ceb3b2e4c296cf6226798d804fa22 ]
DEFAULT_SYMBOL_NAMESPACE must already be defined when <linux/export.h> is included. So move the define above the include block.
--- drivers/i2c/busses/i2c-designware-common.c | 5 +++-- drivers/i2c/busses/i2c-designware-master.c | 5 +++-- drivers/i2c/busses/i2c-designware-slave.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-designware-common.c +3 -2
@@ -8,6 +8,9 @@* Copyright (C) 2007 MontaVista Software Inc. * Copyright (C) 2009 Provigent Ltd. */ + +#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW_COMMON" +#include <linux/acpi.h> #include <linux/clk.h> #include <linux/delay.h>
@@ -29,8 +32,6 @@#include <linux/types.h> #include <linux/units.h> -#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW_COMMON" -#include "i2c-designware-core.h" static const char *const abort_sources[] = {
drivers/i2c/busses/i2c-designware-master.c +3 -2
@@ -8,6 +8,9 @@* Copyright (C) 2007 MontaVista Software Inc. * Copyright (C) 2009 Provigent Ltd. */ + +#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW" +#include <linux/delay.h> #include <linux/err.h> #include <linux/errno.h>
@@ -22,8 +25,6 @@#include <linux/regmap.h> #include <linux/reset.h> -#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW" -#include "i2c-designware-core.h" #define AMD_TIMEOUT_MIN_US 25
drivers/i2c/busses/i2c-designware-slave.c +3 -2
@@ -6,6 +6,9 @@* * Copyright (C) 2016 Synopsys Inc. */ + +#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW" +#include <linux/delay.h> #include <linux/err.h> #include <linux/errno.h>
@@ -16,8 +19,6 @@#include <linux/pm_runtime.h> #include <linux/regmap.h> -#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW" -#include "i2c-designware-core.h" static void i2c_dw_configure_fifo_slave (struct dw_i2c_dev *dev)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/623 cpufreq: ACPI: Fix max-frequency computation
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gautham R. Shenoy <[email protected]>
[ Upstream commit 0834667545962ef1c5e8684ed32b45d9c574acd3 ]
Commit 3c55e94c0ade ("cpufreq: ACPI: Extend frequency tables to cover boost frequencies") introduced an assumption in acpi_cpufreq_cpu_init() that the first entry in the P-state table was the nominal frequency. This assumption is incorrect. The frequency corresponding to the P0 P-State need not be the same as the nominal frequency advertised via CPPC.
Since the driver is using the CPPC.highest_perf and CPPC.nominal_perf to compute the boost-ratio, it makes sense to use CPPC.nominal_freq to compute the max-frequency. CPPC.nominal_freq is advertised on platforms supporting CPPC revisions 3 or higher.
Hence, fallback to using the first entry in the P-State table only on platforms that do not advertise CPPC.nominal_freq.
--- drivers/cpufreq/acpi-cpufreq.c | 36 +++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-)
drivers/cpufreq/acpi-cpufreq.c +27 -9
@@ -623,7 +623,14 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c)#endif #ifdef CONFIG_ACPI_CPPC_LIB -static u64 get_max_boost_ratio (unsigned int cpu) +/* +* get_max_boost_ratio: Computes the max_boost_ratio as the ratio +* between the highest_perf and the nominal_perf. +* +* Returns the max_boost_ratio for @cpu. Returns the CPPC nominal +* frequency via @nominal_freq if it is non-NULL pointer. +*/ +static u64 get_max_boost_ratio (unsigned int cpu,u64 *nominal_freq) {struct cppc_perf_caps perf_caps;u64 highest_perf, nominal_perf;
@@ -652,6 +659,9 @@ static u64 get_max_boost_ratio(unsigned int cpu) nominal_perf = perf_caps.nominal_perf; +if (nominal_freq) + *nominal_freq = perf_caps.nominal_freq; +if (!highest_perf || !nominal_perf) {pr_debug ("CPU%d: highest or nominal performance missing\n" , cpu);return 0 ;
@@ -664,8 +674,12 @@ static u64 get_max_boost_ratio(unsigned int cpu) return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf); } +#else -static inline u64 get_max_boost_ratio (unsigned int cpu) {return 0 ; } +static inline u64 get_max_boost_ratio (unsigned int cpu,u64 *nominal_freq) +{ +return 0 ; +}#endif static int acpi_cpufreq_cpu_init (struct cpufreq_policy *policy)
@@ -675,9 +689,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)struct acpi_cpufreq_data *data;unsigned int cpu = policy->cpu;struct cpuinfo_x86 *c = &cpu_data (cpu); +u64 max_boost_ratio, nominal_freq =0 ;unsigned int valid_states =0 ;unsigned int result =0 ; -u64 max_boost_ratio;unsigned int i;#ifdef CONFIG_SMP static int blacklisted;
@@ -827,16 +841,20 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) } freq_table[valid_states].frequency =CPUFREQ_TABLE_END ; - max_boost_ratio =get_max_boost_ratio (cpu); + max_boost_ratio =get_max_boost_ratio (cpu, &nominal_freq);if (max_boost_ratio) { -unsigned int freq = freq_table[0 ].frequency; +unsigned int freq = nominal_freq;/* -* Because the loop above sorts the freq_table entries in the -* descending order, freq is the maximum frequency in the table. -* Assume that it corresponds to the CPPC nominal frequency and -* use it to set cpuinfo.max_freq. +* The loop above sorts the freq_table entries in the +* descending order. If ACPI CPPC has not advertised +* the nominal frequency (this is possible in CPPC +* revisions prior to 3), then use the first entry in +* the pstate table as a proxy for nominal frequency. */ +if (!freq) + freq = freq_table[0 ].frequency; + policy->cpuinfo.max_freq = freq * max_boost_ratio >>SCHED_CAPACITY_SHIFT ; }else {/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/623 wifi: ath12k: fix key cache handling
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aditya Kumar Singh <[email protected]>
[ Upstream commit 336097d74c284a7c928b723ce8690f28912da03d ]
Currently, an interface is created in the driver during channel assignment. If mac80211 attempts to set a key for an interface before this assignment, the driver caches the key. Once the interface is created, the driver installs the cached key to the hardware. This sequence is exemplified in mesh mode operation where the group key is set before channel assignment.
However, in ath12k_mac_update_key_cache(), after caching the key, due to incorrect logic, it is deleted from the cache during the subsequent loop iteration. As a result, after the interface is created, the driver does not find any cached key, and the key is not installed to the hardware which is wrong. This leads to issue in mesh, where broadcast traffic is not encrypted over the air.
Fix this issue by adjusting the logic of ath12k_mac_update_key_cache() properly.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3-03253.1-QCAHKSWPL_SILICONZ-29 # Nicolas Escande <[email protected]>
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1 # Nicolas Escande <[email protected]>
--- drivers/net/wireless/ath/ath12k/mac.c | 30 ++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +18 -12
@@ -4316,7 +4316,23 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache,struct ieee80211_sta *sta, struct ieee80211_key_conf *key) { - struct ath12k_key_conf *key_conf = NULL, *tmp; + struct ath12k_key_conf *key_conf, *tmp; + +list_for_each_entry_safe (key_conf, tmp, &cache->key_conf.list, list) { +if (key_conf->key != key) +continue ; + +/* If SET key entry is already present in cache, nothing to do, +* just return +*/ +if (cmd ==SET_KEY ) +return 0 ; + +/* DEL key for an old SET key which driver hasn't flushed yet. +*/ +list_del (&key_conf->list); +kfree (key_conf); + }if (cmd ==SET_KEY ) { key_conf =kzalloc (sizeof (*key_conf),GFP_KERNEL );
@@ -4330,17 +4346,7 @@ static int ath12k_mac_update_key_cache(struct ath12k_vif_cache *cache,list_add_tail (&key_conf->list, &cache->key_conf.list); } -if (list_empty (&cache->key_conf.list)) -return 0 ; -list_for_each_entry_safe (key_conf, tmp, &cache->key_conf.list, list) { -if (key_conf->key == key) { -/* DEL key for an old SET key which driver hasn't flushed yet. -*/ -list_del (&key_conf->list); -kfree (key_conf); -break ; - } - } +return 0 ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/623 selftests: timers: clocksource-switch: Adapt progress to kselftest framework
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 8694e6a7f7dba23d3abd9f5a96f64d161704c7b1 ]
When adapting the test to the kselftest framework, a few printf() calls indicating test progress were not updated.
Fix this by replacing these printf() calls by ksft_print_msg() calls.
--- tools/testing/selftests/timers/clocksource-switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/timers/clocksource-switch.c +3 -3
@@ -156,8 +156,8 @@ int main(int argc, char **argv)/* Check everything is sane before we start switching asynchronously */ if (do_sanity_check) {for (i =0 ; i < count; i++) { -printf ("Validating clocksource %s\n" , - clocksource_list[i]); +ksft_print_msg ("Validating clocksource %s\n" , + clocksource_list[i]);if (change_clocksource (clocksource_list[i])) { status =-1 ; goto out;
@@ -169,7 +169,7 @@ int main(int argc, char **argv) } } -printf ("Running Asynchronous Switching Tests...\n" ); +ksft_print_msg ("Running Asynchronous Switching Tests...\n" ); pid =fork ();if (!pid)return run_tests (runtime);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/623 selftests: harness: fix printing of mismatch values in __EXPECT()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry V. Levin <[email protected]>
[ Upstream commit 02bc220dc6dc7c56edc4859bc5dd2c08b95d5fb5 ]
intptr_t and uintptr_t are not big enough types on 32-bit architectures when printing 64-bit values, resulting to the following incorrect diagnostic output:
# get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (3134324433)
Replace intptr_t and uintptr_t with intmax_t and uintmax_t, respectively. With this fix, the same test produces more usable diagnostic output:
# get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (18446744072548908753)
--- tools/testing/selftests/kselftest_harness.h | 24 ++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-)
tools/testing/selftests/kselftest_harness.h +12 -12
@@ -760,33 +760,33 @@/* Report with actual signedness to avoid weird output. */ \switch (is_signed_type (__exp) *2 +is_signed_type (__seen)) { \case 0 : { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%llu)" , \ +uintmax_t __exp_print = (uintmax_t )__exp; \ +uintmax_t __seen_print = (uintmax_t )__seen; \ +__TH_LOG ("Expected %s (%ju) %s %s (%ju)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 1 : { \ -unsigned long long __exp_print = (uintptr_t )__exp; \ -long long __seen_print = (intptr_t )__seen; \ -__TH_LOG ("Expected %s (%llu) %s %s (%lld)" , \ +uintmax_t __exp_print = (uintmax_t )__exp; \ +intmax_t __seen_print = (intmax_t )__seen; \ +__TH_LOG ("Expected %s (%ju) %s %s (%jd)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 2 : { \ -long long __exp_print = (intptr_t )__exp; \ -unsigned long long __seen_print = (uintptr_t )__seen; \ -__TH_LOG ("Expected %s (%lld) %s %s (%llu)" , \ +intmax_t __exp_print = (intmax_t )__exp; \ +uintmax_t __seen_print = (uintmax_t )__seen; \ +__TH_LOG ("Expected %s (%jd) %s %s (%ju)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \ } \case 3 : { \ -long long __exp_print = (intptr_t )__exp; \ -long long __seen_print = (intptr_t )__seen; \ -__TH_LOG ("Expected %s (%lld) %s %s (%lld)" , \ +intmax_t __exp_print = (intmax_t )__exp; \ +intmax_t __seen_print = (intmax_t )__seen; \ +__TH_LOG ("Expected %s (%jd) %s %s (%jd)" , \ _expected_str, __exp_print, #_t, \ _seen_str, __seen_print); \break ; \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/623 wifi: cfg80211: adjust allocation of colocated AP data
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Antipov <[email protected]>
[ Upstream commit 1a0d24775cdee2b8dc14bfa4f4418c930ab1ac57 ]
In 'cfg80211_scan_6ghz()', an instances of 'struct cfg80211_colocated_ap' are allocated as if they would have 'ssid' as trailing VLA member. Since this is not so, extra IEEE80211_MAX_SSID_LEN bytes are not needed. Briefly tested with KUnit.
--- net/wireless/scan.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/wireless/scan.c +1 -3
@@ -857,9 +857,7 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)if (ret)continue ; - entry =kzalloc (sizeof (*entry) +IEEE80211_MAX_SSID_LEN , -GFP_ATOMIC ); - + entry =kzalloc (sizeof (*entry),GFP_ATOMIC );if (!entry)continue ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/623 Bluetooth: btbcm: Fix NULL deref in btbcm_get_board_name()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit b88655bc6593c6a7fdc1248b212d17e581c4334e ]
devm_kstrdup() can return a NULL pointer on failure,but this returned value in btbcm_get_board_name() is not checked. Add NULL check in btbcm_get_board_name(), to handle kernel NULL pointer dereference error.
--- drivers/bluetooth/btbcm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/bluetooth/btbcm.c +3 -0
@@ -553,6 +553,9 @@ static const char *btbcm_get_board_name(struct device *dev)/* get rid of any '/' in the compatible string */ board_type =devm_kstrdup (dev, tmp,GFP_KERNEL ); +if (!board_type) +return NULL ; +strreplace (board_type,'/' ,'-' );return board_type;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/623 Bluetooth: btrtl: check for NULL in btrtl_setup_realtek()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Max Chou <[email protected]>
[ Upstream commit 3c15082f3567032d196e8760753373332508c2ca ]
If insert an USB dongle which chip is not maintained in ic_id_table, it will hit the NULL point accessed. Add a null point check to avoid the Kernel Oops.
--- drivers/bluetooth/btrtl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bluetooth/btrtl.c +3 -1
@@ -1351,12 +1351,14 @@ int btrtl_setup_realtek(struct hci_dev *hdev)btrtl_set_quirks (hdev, btrtl_dev); -hci_set_hw_info (hdev, +if (btrtl_dev->ic_info) { +hci_set_hw_info (hdev,"RTL lmp_subver=%u hci_rev=%u hci_ver=%u hci_bus=%u" , btrtl_dev->ic_info->lmp_subver, btrtl_dev->ic_info->hci_rev, btrtl_dev->ic_info->hci_ver, btrtl_dev->ic_info->hci_bus); + }btrtl_free (btrtl_dev);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/623 wifi: wilc1000: unregister wiphy only after netdev registration
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexis Lothoré <[email protected]>
[ Upstream commit 208dea9107e80a33dfeb029bdb93cb53eccf005d ]
wiphy_unregister()/wiphy_free() has been recently decoupled from wilc_netdev_cleanup() to fix a faulty error path in sdio/spi probe functions. However this change introduced a new failure when simply loading then unloading the driver:
$ modprobe wilc1000-sdio; modprobe -r wilc1000-sdio WARNING: CPU: 0 PID: 115 at net/wireless/core.c:1145 wiphy_unregister+0x904/0xc40 [cfg80211] Modules linked in: wilc1000_sdio(-) wilc1000 cfg80211 bluetooth ecdh_generic ecc CPU: 0 UID: 0 PID: 115 Comm: modprobe Not tainted 6.13.0-rc6+ #45 Hardware name: Atmel SAMA5 Call trace: unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x44/0x70 dump_stack_lvl from __warn+0x118/0x27c __warn from warn_slowpath_fmt+0xcc/0x140 warn_slowpath_fmt from wiphy_unregister+0x904/0xc40 [cfg80211] wiphy_unregister [cfg80211] from wilc_sdio_remove+0xb0/0x15c [wilc1000_sdio] wilc_sdio_remove [wilc1000_sdio] from sdio_bus_remove+0x104/0x3f0 sdio_bus_remove from device_release_driver_internal+0x424/0x5dc device_release_driver_internal from driver_detach+0x120/0x224 driver_detach from bus_remove_driver+0x17c/0x314 bus_remove_driver from sys_delete_module+0x310/0x46c sys_delete_module from ret_fast_syscall+0x0/0x1c Exception stack(0xd0acbfa8 to 0xd0acbff0) bfa0: 0044b210 0044b210 0044b24c 00000800 00000000 00000000 bfc0: 0044b210 0044b210 00000000 00000081 00000000 0044b210 00000000 00000000 bfe0: 00448e24 b6af99c4 0043ea0d aea2e12c irq event stamp: 0 hardirqs last enabled at (0): [<00000000>] 0x0 hardirqs last disabled at (0): [<c01588f0>] copy_process+0x1c4c/0x7bec softirqs last enabled at (0): [<c0158944>] copy_process+0x1ca0/0x7bec softirqs last disabled at (0): [<00000000>] 0x0
The warning is triggered by the fact that there is still a wireless_device linked to the wiphy we are unregistering, due to wiphy_unregister() now being called after net device unregister (performed in wilc_netdev_cleanup()). Fix this warning by moving wiphy_unregister() after wilc_netdev_cleanup() is nominal paths (ie: driver removal). wilc_netdev_cleanup() ordering is left untouched in error paths in probe function because net device is not registered in those paths (so the warning can not trigger), yet the wiphy can still be registered, and we still some cleanup steps from wilc_netdev_cleanup().
--- drivers/net/wireless/microchip/wilc1000/sdio.c | 2 +- drivers/net/wireless/microchip/wilc1000/spi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/microchip/wilc1000/sdio.c +1 -1
@@ -225,8 +225,8 @@ static void wilc_sdio_remove(struct sdio_func *func)struct wilc *wilc =sdio_get_drvdata (func);struct wilc_sdio *sdio_priv = wilc->bus_data; -wiphy_unregister (wilc->wiphy);wilc_netdev_cleanup (wilc); +wiphy_unregister (wilc->wiphy);wiphy_free (wilc->wiphy);kfree (sdio_priv->cmd53_buf);kfree (sdio_priv);
drivers/net/wireless/microchip/wilc1000/spi.c +1 -1
@@ -285,8 +285,8 @@ static void wilc_bus_remove(struct spi_device *spi)struct wilc *wilc =spi_get_drvdata (spi);struct wilc_spi *spi_priv = wilc->bus_data; -wiphy_unregister (wilc->wiphy);wilc_netdev_cleanup (wilc); +wiphy_unregister (wilc->wiphy);wiphy_free (wilc->wiphy);kfree (spi_priv); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/623 inet: ipmr: fix data-races
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 3440fa34ad99d471f1085bc2f4dedeaebc310261 ]
Following fields of 'struct mr_mfc' can be updated concurrently (no lock protection) from ip_mr_forward() and ip6_mr_forward()
- bytes
- pkt
- wrong_if
- lastuse
They also can be read from other functions.
Convert bytes, pkt and wrong_if to atomic_long_t, and use READ_ONCE()/WRITE_ONCE() for lastuse.
--- .../net/ethernet/mellanox/mlxsw/spectrum_mr.c | 8 +++--- include/linux/mroute_base.h | 6 ++-- net/ipv4/ipmr.c | 28 +++++++++---------- net/ipv4/ipmr_base.c | 6 ++-- net/ipv6/ip6mr.c | 28 +++++++++---------- 5 files changed, 38 insertions(+), 38 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +4 -4
@@ -1003,10 +1003,10 @@ static void mlxsw_sp_mr_route_stats_update(struct mlxsw_sp *mlxsw_sp, mr->mr_ops->route_stats (mlxsw_sp, mr_route->route_priv, &packets, &bytes); -if (mr_route->mfc->mfc_un.res.pkt != packets) - mr_route->mfc->mfc_un.res.lastuse = jiffies; - mr_route->mfc->mfc_un.res.pkt = packets; - mr_route->mfc->mfc_un.res.bytes = bytes; +if (atomic_long_read (&mr_route->mfc->mfc_un.res.pkt) != packets) +WRITE_ONCE (mr_route->mfc->mfc_un.res.lastuse, jiffies); +atomic_long_set (&mr_route->mfc->mfc_un.res.pkt, packets); +atomic_long_set (&mr_route->mfc->mfc_un.res.bytes, bytes); }static void mlxsw_sp_mr_stats_update (struct work_struct *work)
include/linux/mroute_base.h +3 -3
@@ -146,9 +146,9 @@ struct mr_mfc {unsigned long last_assert;int minvif;int maxvif; -unsigned long bytes; -unsigned long pkt; -unsigned long wrong_if; +atomic_long_t bytes; +atomic_long_t pkt; +atomic_long_t wrong_if;unsigned long lastuse;unsigned char ttls[MAXVIFS ];refcount_t refcount;
net/ipv4/ipmr.c +14 -14
@@ -831,7 +831,7 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache, cache->mfc_un.res.maxvif = vifi +1 ; } } - cache->mfc_un.res.lastuse = jiffies; +WRITE_ONCE (cache->mfc_un.res.lastuse, jiffies); } static int vif_add(struct net *net, struct mr_table *mrt,
@@ -1681,9 +1681,9 @@ int ipmr_ioctl(struct sock *sk, int cmd, void *arg)rcu_read_lock (); c =ipmr_cache_find (mrt, sr->src.s_addr, sr->grp.s_addr);if (c) { - sr->pktcnt = c->_c.mfc_un.res.pkt; - sr->bytecnt = c->_c.mfc_un.res.bytes; - sr->wrong_if = c->_c.mfc_un.res.wrong_if; + sr->pktcnt =atomic_long_read (&c->_c.mfc_un.res.pkt); + sr->bytecnt =atomic_long_read (&c->_c.mfc_un.res.bytes); + sr->wrong_if =atomic_long_read (&c->_c.mfc_un.res.wrong_if);rcu_read_unlock ();return 0 ; }
@@ -1753,9 +1753,9 @@ int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)rcu_read_lock (); c =ipmr_cache_find (mrt, sr.src.s_addr, sr.grp.s_addr);if (c) { - sr.pktcnt = c->_c.mfc_un.res.pkt; - sr.bytecnt = c->_c.mfc_un.res.bytes; - sr.wrong_if = c->_c.mfc_un.res.wrong_if; + sr.pktcnt =atomic_long_read (&c->_c.mfc_un.res.pkt); + sr.bytecnt =atomic_long_read (&c->_c.mfc_un.res.bytes); + sr.wrong_if =atomic_long_read (&c->_c.mfc_un.res.wrong_if);rcu_read_unlock ();if (copy_to_user (arg, &sr,sizeof (sr)))
@@ -1988,9 +1988,9 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt,int vif, ct; vif = c->_c.mfc_parent; - c->_c.mfc_un.res.pkt++; - c->_c.mfc_un.res.bytes += skb->len; - c->_c.mfc_un.res.lastuse = jiffies; +atomic_long_inc (&c->_c.mfc_un.res.pkt); +atomic_long_add (skb->len, &c->_c.mfc_un.res.bytes); +WRITE_ONCE (c->_c.mfc_un.res.lastuse, jiffies);if (c->mfc_origin ==htonl (INADDR_ANY ) && true_vifi >=0 ) {struct mfc_cache *cache_proxy;
@@ -2021,7 +2021,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, goto dont_forward; } - c->_c.mfc_un.res.wrong_if++; +atomic_long_inc (&c->_c.mfc_un.res.wrong_if); if (true_vifi >= 0 && mrt->mroute_do_assert &&/* pimsm uses asserts, when switching from RPT to SPT,
@@ -3029,9 +3029,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)if (it->cache != &mrt->mfc_unres_queue) {seq_printf (seq," %8lu %8lu %8lu" , - mfc->_c.mfc_un.res.pkt, - mfc->_c.mfc_un.res.bytes, - mfc->_c.mfc_un.res.wrong_if); +atomic_long_read (&mfc->_c.mfc_un.res.pkt), +atomic_long_read (&mfc->_c.mfc_un.res.bytes), +atomic_long_read (&mfc->_c.mfc_un.res.wrong_if));for (n = mfc->_c.mfc_un.res.minvif; n < mfc->_c.mfc_un.res.maxvif; n++) { if (VIF_EXISTS(mrt, n) &&
net/ipv4/ipmr_base.c +3 -3
@@ -263,9 +263,9 @@ int mr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, lastuse =READ_ONCE (c->mfc_un.res.lastuse); lastuse =time_after_eq (jiffies, lastuse) ? jiffies - lastuse :0 ; - mfcs.mfcs_packets = c->mfc_un.res.pkt; - mfcs.mfcs_bytes = c->mfc_un.res.bytes; - mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; + mfcs.mfcs_packets =atomic_long_read (&c->mfc_un.res.pkt); + mfcs.mfcs_bytes =atomic_long_read (&c->mfc_un.res.bytes); + mfcs.mfcs_wrong_if =atomic_long_read (&c->mfc_un.res.wrong_if);if (nla_put_64bit (skb,RTA_MFC_STATS ,sizeof (mfcs), &mfcs,RTA_PAD ) ||nla_put_u64_64bit (skb,RTA_EXPIRES ,jiffies_to_clock_t (lastuse),RTA_PAD ))
net/ipv6/ip6mr.c +14 -14
@@ -520,9 +520,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)if (it->cache != &mrt->mfc_unres_queue) {seq_printf (seq," %8lu %8lu %8lu" , - mfc->_c.mfc_un.res.pkt, - mfc->_c.mfc_un.res.bytes, - mfc->_c.mfc_un.res.wrong_if); +atomic_long_read (&mfc->_c.mfc_un.res.pkt), +atomic_long_read (&mfc->_c.mfc_un.res.bytes), +atomic_long_read (&mfc->_c.mfc_un.res.wrong_if));for (n = mfc->_c.mfc_un.res.minvif; n < mfc->_c.mfc_un.res.maxvif; n++) { if (VIF_EXISTS(mrt, n) &&
@@ -884,7 +884,7 @@ static void ip6mr_update_thresholds(struct mr_table *mrt, cache->mfc_un.res.maxvif = vifi +1 ; } } - cache->mfc_un.res.lastuse = jiffies; +WRITE_ONCE (cache->mfc_un.res.lastuse, jiffies); } static int mif6_add(struct net *net, struct mr_table *mrt,
@@ -1945,9 +1945,9 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void *arg) c =ip6mr_cache_find (mrt, &sr->src.sin6_addr, &sr->grp.sin6_addr);if (c) { - sr->pktcnt = c->_c.mfc_un.res.pkt; - sr->bytecnt = c->_c.mfc_un.res.bytes; - sr->wrong_if = c->_c.mfc_un.res.wrong_if; + sr->pktcnt =atomic_long_read (&c->_c.mfc_un.res.pkt); + sr->bytecnt =atomic_long_read (&c->_c.mfc_un.res.bytes); + sr->wrong_if =atomic_long_read (&c->_c.mfc_un.res.wrong_if);rcu_read_unlock ();return 0 ; }
@@ -2017,9 +2017,9 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg)rcu_read_lock (); c =ip6mr_cache_find (mrt, &sr.src.sin6_addr, &sr.grp.sin6_addr);if (c) { - sr.pktcnt = c->_c.mfc_un.res.pkt; - sr.bytecnt = c->_c.mfc_un.res.bytes; - sr.wrong_if = c->_c.mfc_un.res.wrong_if; + sr.pktcnt =atomic_long_read (&c->_c.mfc_un.res.pkt); + sr.bytecnt =atomic_long_read (&c->_c.mfc_un.res.bytes); + sr.wrong_if =atomic_long_read (&c->_c.mfc_un.res.wrong_if);rcu_read_unlock ();if (copy_to_user (arg, &sr,sizeof (sr)))
@@ -2142,9 +2142,9 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt,int true_vifi =ip6mr_find_vif (mrt, dev); vif = c->_c.mfc_parent; - c->_c.mfc_un.res.pkt++; - c->_c.mfc_un.res.bytes += skb->len; - c->_c.mfc_un.res.lastuse = jiffies; +atomic_long_inc (&c->_c.mfc_un.res.pkt); +atomic_long_add (skb->len, &c->_c.mfc_un.res.bytes); +WRITE_ONCE (c->_c.mfc_un.res.lastuse, jiffies);if (ipv6_addr_any (&c->mf6c_origin) && true_vifi >=0 ) {struct mfc6_cache *cache_proxy;
@@ -2162,7 +2162,7 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt,* Wrong interface: drop packet and (maybe) send PIM assert. */ if (rcu_access_pointer (mrt->vif_table[vif].dev) != dev) { - c->_c.mfc_un.res.wrong_if++; +atomic_long_inc (&c->_c.mfc_un.res.wrong_if); if (true_vifi >= 0 && mrt->mroute_do_assert &&/* pimsm uses asserts, when switching from RPT to SPT,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/623 clk: analogbits: Fix incorrect calculation of vco rate delta
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bo Gan <[email protected]>
[ Upstream commit d7f12857f095ef38523399d47e68787b357232f6 ]
In wrpll_configure_for_rate() we try to determine the best PLL configuration for a target rate. However, in the loop where we try values of R, we should compare the derived vco with target_vco_rate. However, we were in fact comparing it with target_rate, which is actually after Q shift. This is incorrect, and sometimes can result in suboptimal clock rates. Fix it.
--- drivers/clk/analogbits/wrpll-cln28hpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/analogbits/wrpll-cln28hpc.c +1 -1
@@ -292,7 +292,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate, vco = vco_pre * f; } - delta =abs (target_rate - vco); + delta =abs (target_vco_rate - vco);if (delta < best_delta) { best_delta = delta; best_r = r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/623 dev: Acquire netdev_rename_lock before restoring dev->name in dev_change_name().
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e361560a7912958ba3059f51e7dd21612d119169 ]
The cited commit forgot to add netdev_rename_lock in one of the error paths in dev_change_name().
Let's hold netdev_rename_lock before restoring the old dev->name.
--- net/core/dev.c | 2 ++ 1 file changed, 2 insertions(+)
net/core/dev.c +2 -0
@@ -1279,7 +1279,9 @@ int dev_change_name(struct net_device *dev, const char *newname) rollback: ret =device_rename (&dev->dev, dev->name);if (ret) { +write_seqlock_bh (&netdev_rename_lock);memcpy (dev->name, oldname,IFNAMSIZ ); +write_sequnlock_bh (&netdev_rename_lock);WRITE_ONCE (dev->name_assign_type, old_assign_type);up_write (&devnet_rename_sem);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/623 pwm: stm32: Add check for clk_enable()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mingwei Zheng <[email protected]>
[ Upstream commit e8c59791ebb60790c74b2c3ab520f04a8a57219a ]
Add check for the return value of clk_enable() to catch the potential error.
--- drivers/pwm/pwm-stm32.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/pwm/pwm-stm32.c +5 -2
@@ -858,8 +858,11 @@ static int stm32_pwm_probe(struct platform_device *pdev) chip->ops = &stm32pwm_ops;/* Initialize clock refcount to number of enabled PWM channels. */ -for (i =0 ; i < num_enabled; i++) -clk_enable (priv->clk); +for (i =0 ; i < num_enabled; i++) { + ret =clk_enable (priv->clk); +if (ret) +return ret; + } ret =devm_pwmchip_add (dev, chip);if (ret <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/623 net: phy: realtek: clear 1000Base-T lpa if link is down
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit 34d5a86ff7bbe225fba3ad91f9b4dc85fb408e18 ]
Only read 1000Base-T link partner advertisement if autonegotiation has completed and otherwise 1000Base-T link partner advertisement bits.
This fixes bogus 1000Base-T link partner advertisement after link goes down (eg. by disconnecting the wire).
--- drivers/net/phy/realtek.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/net/phy/realtek.c +8 -11
@@ -1023,23 +1023,20 @@ static int rtl822x_c45_read_status(struct phy_device *phydev) {int ret, val; - ret =genphy_c45_read_status (phydev); -if (ret <0 ) -return ret; - -if (phydev->autoneg ==AUTONEG_DISABLE || - !genphy_c45_aneg_done (phydev)) -mii_stat1000_mod_linkmode_lpa_t (phydev->lp_advertising,0 ); -/* Vendor register as C45 has no standardized support for 1000BaseT */ -if (phydev->autoneg ==AUTONEG_ENABLE ) { +if (phydev->autoneg ==AUTONEG_ENABLE &&genphy_c45_aneg_done (phydev)) { val =phy_read_mmd (phydev,MDIO_MMD_VEND2 ,RTL822X_VND2_GANLPAR );if (val <0 )return val; - -mii_stat1000_mod_linkmode_lpa_t (phydev->lp_advertising, val); + }else { + val =0 ; } +mii_stat1000_mod_linkmode_lpa_t (phydev->lp_advertising, val); + + ret =genphy_c45_read_status (phydev); +if (ret <0 ) +return ret;if (!phydev->link)return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/623 net: phy: realtek: clear master_slave_state if link is down
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit ea8318cb33e593bbfc59d637eae45a69732c5387 ]
rtlgen_decode_physr() which sets master_slave_state isn't called in case the link is down and other than rtlgen_read_status(), rtl822x_c45_read_status() doesn't implicitely clear master_slave_state.
Avoid stale master_slave_state by always setting it to MASTER_SLAVE_STATE_UNKNOWN in rtl822x_c45_read_status() in case the link is down.
--- drivers/net/phy/realtek.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/phy/realtek.c +3 -1
@@ -1038,8 +1038,10 @@ static int rtl822x_c45_read_status(struct phy_device *phydev)if (ret <0 )return ret; -if (!phydev->link) +if (!phydev->link) { + phydev->master_slave_state =MASTER_SLAVE_STATE_UNKNOWN ;return 0 ; + }/* Read actual speed from vendor register. */ val =phy_read_mmd (phydev,MDIO_MMD_VEND2 ,RTL_VND2_PHYSR );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/623 net: phy: realtek: always clear NBase-T lpa
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit d3eb58549842c60ed46f37da7f4da969e3d6ecd3 ]
Clear NBase-T link partner advertisement before calling rtlgen_read_status() to avoid phy_resolve_aneg_linkmode() wrongly setting speed and duplex.
This fixes bogus 2.5G/5G/10G link partner advertisement and thus speed and duplex being set by phy_resolve_aneg_linkmode() due to stale NBase-T lpa.
--- drivers/net/phy/realtek.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/phy/realtek.c +3 -3
@@ -952,15 +952,15 @@ static int rtl822x_read_status(struct phy_device *phydev) {int lpadv, ret; +mii_10gbt_stat_mod_linkmode_lpa_t (phydev->lp_advertising,0 ); + ret =rtlgen_read_status (phydev);if (ret <0 )return ret;if (phydev->autoneg ==AUTONEG_DISABLE || - !phydev->autoneg_complete) { -mii_10gbt_stat_mod_linkmode_lpa_t (phydev->lp_advertising,0 ); + !phydev->autoneg_complete)return 0 ; - } lpadv =phy_read_paged (phydev,0xa5d ,0x13 );if (lpadv <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/623 selftests/landlock: Fix build with non-default pthread linking
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
[ Upstream commit 0e4db4f843c2c0115b5981bd6f6b75dea62e7d60 ]
Old toolchains require explicit -lpthread (e.g. on Debian 11).
--- tools/testing/selftests/landlock/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/landlock/Makefile +2 -2
@@ -13,11 +13,11 @@ TEST_GEN_PROGS := $(src_test:.c=) TEST_GEN_PROGS_EXTENDED := true # Short targets: -$(TEST_GEN_PROGS): LDLIBS += -lcap +$(TEST_GEN_PROGS): LDLIBS += -lcap -lpthread $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static include ../lib.mk # Targets with $(OUTPUT)/ prefix: -$(TEST_GEN_PROGS): LDLIBS += -lcap +$(TEST_GEN_PROGS): LDLIBS += -lcap -lpthread $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/623 selftests/landlock: Fix error message
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
[ Upstream commit 2107c35128ad751b201eb92fe91443450d9e5c37 ]
The global variable errno may not be set in test_execute(). Do not use it in related error message.
--- tools/testing/selftests/landlock/fs_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
tools/testing/selftests/landlock/fs_test.c +1 -2
@@ -2003,8 +2003,7 @@ static void test_execute(struct __test_metadata *const _metadata, const int err,ASSERT_EQ (1 ,WIFEXITED (status)); ASSERT_EQ(err ? 2 : 0, WEXITSTATUS(status)) { -TH_LOG ("Unexpected return code for \"%s\": %s" , path, -strerror (errno)); +TH_LOG ("Unexpected return code for \"%s\"" , path); }; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/623 net: let net.core.dev_weight always be non-zero
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Jian <[email protected]>
[ Upstream commit d1f9f79fa2af8e3b45cffdeef66e05833480148a ]
The following problem was encountered during stability test:
(NULL net_device): NAPI poll function process_backlog+0x0/0x530 \
returned 1, exceeding its budget of 0.
------------[ cut here ]------------ list_add double add: new=ffff88905f746f48, prev=ffff88905f746f48, \ next=ffff88905f746e40. WARNING: CPU: 18 PID: 5462 at lib/list_debug.c:35 \ __list_add_valid_or_report+0xf3/0x130 CPU: 18 UID: 0 PID: 5462 Comm: ping Kdump: loaded Not tainted 6.13.0-rc7+ RIP: 0010:__list_add_valid_or_report+0xf3/0x130 Call Trace: ? __warn+0xcd/0x250 ? __list_add_valid_or_report+0xf3/0x130 enqueue_to_backlog+0x923/0x1070 netif_rx_internal+0x92/0x2b0 __netif_rx+0x15/0x170 loopback_xmit+0x2ef/0x450 dev_hard_start_xmit+0x103/0x490 __dev_queue_xmit+0xeac/0x1950 ip_finish_output2+0x6cc/0x1620 ip_output+0x161/0x270 ip_push_pending_frames+0x155/0x1a0 raw_sendmsg+0xe13/0x1550 __sys_sendto+0x3bf/0x4e0 __x64_sys_sendto+0xdc/0x1b0 do_syscall_64+0x5b/0x170 entry_SYSCALL_64_after_hwframe+0x76/0x7e
The reproduction command is as follows:
sysctl -w net.core.dev_weight=0
ping 127.0.0.1
This is because when the napi's weight is set to 0, process_backlog() may return 0 and clear the NAPI_STATE_SCHED bit of napi->state, causing this napi to be re-polled in net_rx_action() until __do_softirq() times out. Since the NAPI_STATE_SCHED bit has been cleared, napi_schedule_rps() can be retriggered in enqueue_to_backlog(), causing this issue.
Making the napi's weight always non-zero solves this problem.
Triggering this issue requires system-wide admin (setting is not namespaced).
--- net/core/sysctl_net_core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/core/sysctl_net_core.c +4 -1
@@ -319,7 +319,7 @@ static int proc_do_dev_weight(const struct ctl_table *table, int write,int ret, weight;mutex_lock (&dev_weight_mutex); - ret =proc_dointvec (table, write, buffer, lenp, ppos); + ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (!ret && write) { weight =READ_ONCE (weight_p);WRITE_ONCE (net_hotdata.dev_rx_weight, weight * dev_weight_rx_bias);
@@ -412,6 +412,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_do_dev_weight, + .extra1 = SYSCTL_ONE, }, { .procname = "dev_weight_rx_bias",
@@ -419,6 +420,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_do_dev_weight, + .extra1 = SYSCTL_ONE, }, { .procname = "dev_weight_tx_bias",
@@ -426,6 +428,7 @@ static struct ctl_table net_core_table[] = { .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_do_dev_weight, + .extra1 = SYSCTL_ONE, }, { .procname = "netdev_max_backlog",
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/623 net/mlxfw: Drop hard coded max FW flash image size
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maher Sanalla <[email protected]>
[ Upstream commit 70d81f25cc92cc4e914516c9935ae752f27d78ad ]
Currently, mlxfw kernel module limits FW flash image size to be 10MB at most, preventing the ability to burn recent BlueField-3 FW that exceeds the said size limit.
Thus, drop the hard coded limit. Instead, rely on FW's max_component_size threshold that is reported in MCQI register as the size limit for FW image.
--- drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +0 -2
@@ -14,7 +14,6 @@#define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000#define MLXFW_FSM_STATE_WAIT_ROUNDS \ (MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS) -#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20))static const int mlxfw_fsm_state_errno[] = { [MLXFW_FSM_STATE_ERR_ERROR ] = -EIO ,
@@ -229,7 +228,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev,return err; } - comp_max_size =min_t (u32, comp_max_size,MLXFW_FSM_MAX_COMPONENT_SIZE );if (comp->data_size > comp_max_size) {MLXFW_ERR_MSG (mlxfw_dev, extack,"Component size is bigger than limit" , -EINVAL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/623 octeon_ep: remove firmware stats fetch in ndo_get_stats64
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shinas Rasheed <[email protected]>
[ Upstream commit 1f64255bb76c11d0c41a7d81d7cec68e49d5362d ]
The firmware stats fetch call that happens in ndo_get_stats64() is currently not required, and causes a warning to issue.
The warn log is given below:
[ 123.316837] ------------[ cut here ]------------ [ 123.316840] Voluntary context switch within RCU read-side critical section! [ 123.316917] pc : rcu_note_context_switch+0x2e4/0x300 [ 123.316919] lr : rcu_note_context_switch+0x2e4/0x300 [ 123.316947] Call trace: [ 123.316949] rcu_note_context_switch+0x2e4/0x300 [ 123.316952] __schedule+0x84/0x584 [ 123.316955] schedule+0x38/0x90 [ 123.316956] schedule_timeout+0xa0/0x1d4 [ 123.316959] octep_send_mbox_req+0x190/0x230 [octeon_ep] [ 123.316966] octep_ctrl_net_get_if_stats+0x78/0x100 [octeon_ep] [ 123.316970] octep_get_stats64+0xd4/0xf0 [octeon_ep] [ 123.316975] dev_get_stats+0x4c/0x114 [ 123.316977] dev_seq_printf_stats+0x3c/0x11c [ 123.316980] dev_seq_show+0x1c/0x40 [ 123.316982] seq_read_iter+0x3cc/0x4e0 [ 123.316985] seq_read+0xc8/0x110 [ 123.316987] proc_reg_read+0x9c/0xec [ 123.316990] vfs_read+0xc8/0x2ec [ 123.316993] ksys_read+0x70/0x100 [ 123.316995] __arm64_sys_read+0x20/0x30 [ 123.316997] invoke_syscall.constprop.0+0x7c/0xd0 [ 123.317000] do_el0_svc+0xb4/0xd0 [ 123.317002] el0_svc+0xe8/0x1f4 [ 123.317005] el0t_64_sync_handler+0x134/0x150 [ 123.317006] el0t_64_sync+0x17c/0x180 [ 123.317008] ---[ end trace 63399811432ab69b ]---
--- drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/net/ethernet/marvell/octeon_ep/octep_main.c +0 -10
@@ -995,12 +995,6 @@ static void octep_get_stats64(struct net_device *netdev,struct octep_device *oct =netdev_priv (netdev);int q; -if (netif_running (netdev)) -octep_ctrl_net_get_if_stats (oct, -OCTEP_CTRL_NET_INVALID_VFID , - &oct->iface_rx_stats, - &oct->iface_tx_stats); - tx_packets =0 ; tx_bytes =0 ; rx_packets =0 ;
@@ -1018,10 +1012,6 @@ static void octep_get_stats64(struct net_device *netdev, stats->tx_bytes = tx_bytes; stats->rx_packets = rx_packets; stats->rx_bytes = rx_bytes; - stats->multicast = oct->iface_rx_stats.mcast_pkts; - stats->rx_errors = oct->iface_rx_stats.err_pkts; - stats->collisions = oct->iface_tx_stats.xscol; - stats->tx_fifo_errors = oct->iface_tx_stats.undflw; }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/623 octeon_ep_vf: remove firmware stats fetch in ndo_get_stats64
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shinas Rasheed <[email protected]>
[ Upstream commit cc0e510cc89fe0a6479203bc20cd964962dc6a43 ]
The firmware stats fetch call that happens in ndo_get_stats64() is currently not required, and causes a warning to issue.
The corresponding warn log for the PF is given below:
[ 123.316837] ------------[ cut here ]------------ [ 123.316840] Voluntary context switch within RCU read-side critical section! [ 123.316917] pc : rcu_note_context_switch+0x2e4/0x300 [ 123.316919] lr : rcu_note_context_switch+0x2e4/0x300 [ 123.316947] Call trace: [ 123.316949] rcu_note_context_switch+0x2e4/0x300 [ 123.316952] __schedule+0x84/0x584 [ 123.316955] schedule+0x38/0x90 [ 123.316956] schedule_timeout+0xa0/0x1d4 [ 123.316959] octep_send_mbox_req+0x190/0x230 [octeon_ep] [ 123.316966] octep_ctrl_net_get_if_stats+0x78/0x100 [octeon_ep] [ 123.316970] octep_get_stats64+0xd4/0xf0 [octeon_ep] [ 123.316975] dev_get_stats+0x4c/0x114 [ 123.316977] dev_seq_printf_stats+0x3c/0x11c [ 123.316980] dev_seq_show+0x1c/0x40 [ 123.316982] seq_read_iter+0x3cc/0x4e0 [ 123.316985] seq_read+0xc8/0x110 [ 123.316987] proc_reg_read+0x9c/0xec [ 123.316990] vfs_read+0xc8/0x2ec [ 123.316993] ksys_read+0x70/0x100 [ 123.316995] __arm64_sys_read+0x20/0x30 [ 123.316997] invoke_syscall.constprop.0+0x7c/0xd0 [ 123.317000] do_el0_svc+0xb4/0xd0 [ 123.317002] el0_svc+0xe8/0x1f4 [ 123.317005] el0t_64_sync_handler+0x134/0x150 [ 123.317006] el0t_64_sync+0x17c/0x180 [ 123.317008] ---[ end trace 63399811432ab69b ]---
--- drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/net/ethernet/marvell/octeon_ep_vf/octep_vf_main.c +0 -8
@@ -799,14 +799,6 @@ static void octep_vf_get_stats64(struct net_device *netdev, stats->tx_bytes = tx_bytes; stats->rx_packets = rx_packets; stats->rx_bytes = rx_bytes; -if (!octep_vf_get_if_stats (oct)) { - stats->multicast = oct->iface_rx_stats.mcast_pkts; - stats->rx_errors = oct->iface_rx_stats.err_pkts; - stats->rx_dropped = oct->iface_rx_stats.dropped_pkts_fifo_full + - oct->iface_rx_stats.err_pkts; - stats->rx_missed_errors = oct->iface_rx_stats.dropped_pkts_fifo_full; - stats->tx_dropped = oct->iface_tx_stats.dropped; - } }/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/623 net: avoid race between device unregistration and ethnl ops
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antoine Tenart <[email protected]>
[ Upstream commit 12e070eb6964b341b41677fd260af5a305316a1f ]
The following trace can be seen if a device is being unregistered while its number of channels are being modified.
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: CPU: 3 PID: 3754 at kernel/locking/mutex.c:564 __mutex_lock+0xc8a/0x1120 CPU: 3 UID: 0 PID: 3754 Comm: ethtool Not tainted 6.13.0-rc6+ #771 RIP: 0010:__mutex_lock+0xc8a/0x1120 Call Trace: <TASK> ethtool_check_max_channel+0x1ea/0x880 ethnl_set_channels+0x3c3/0xb10 ethnl_default_set_doit+0x306/0x650 genl_family_rcv_msg_doit+0x1e3/0x2c0 genl_rcv_msg+0x432/0x6f0 netlink_rcv_skb+0x13d/0x3b0 genl_rcv+0x28/0x40 netlink_unicast+0x42e/0x720 netlink_sendmsg+0x765/0xc20 __sys_sendto+0x3ac/0x420 __x64_sys_sendto+0xe0/0x1c0 do_syscall_64+0x95/0x180 entry_SYSCALL_64_after_hwframe+0x76/0x7e
This is because unregister_netdevice_many_notify might run before the rtnl lock section of ethnl operations, eg. set_channels in the above example. In this example the rss lock would be destroyed by the device unregistration path before being used again, but in general running ethnl operations while dismantle has started is not a good idea.
Fix this by denying any operation on devices being unregistered. A check was already there in ethnl_ops_begin, but not wide enough.
Note that the same issue cannot be seen on the ioctl version (__dev_ethtool) because the device reference is retrieved from within the rtnl lock section there. Once dismantle started, the net device is unlisted and no reference will be found.
--- net/ethtool/netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/netlink.c +1 -1
@@ -90,7 +90,7 @@ int ethnl_ops_begin(struct net_device *dev)pm_runtime_get_sync (dev->dev.parent);if (!netif_device_present (dev) || - dev->reg_state ==NETREG_UNREGISTERING ) { + dev->reg_state >=NETREG_UNREGISTERING ) { ret = -ENODEV ; goto err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/623 net: sched: Disallow replacing of child qdisc from one parent to another
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit bc50835e83f60f56e9bec2b392fb5544f250fb6f ]
Lion Ackermann was able to create a UAF which can be abused for privilege escalation with the following script
Step 1. create root qdisc
tc qdisc add dev lo root handle 1:0 drr
step2. a class for packet aggregation do demonstrate uaf tc class add dev lo classid 1:1 drr
step3. a class for nesting
tc class add dev lo classid 1:2 drr
step4. a class to graft qdisc to
tc class add dev lo classid 1:3 drr
step5.
tc qdisc add dev lo parent 1:1 handle 2:0 plug limit 1024
step6.
tc qdisc add dev lo parent 1:2 handle 3:0 drr
step7.
tc class add dev lo classid 3:1 drr
step 8.
tc qdisc add dev lo parent 3:1 handle 4:0 pfifo
step 9. Display the class/qdisc layout
tc class ls dev lo
class drr 1:1 root leaf 2: quantum 64Kb
class drr 1:2 root leaf 3: quantum 64Kb
class drr 3:1 root leaf 4: quantum 64Kb
tc qdisc ls
qdisc drr 1: dev lo root refcnt 2
qdisc plug 2: dev lo parent 1:1
qdisc pfifo 4: dev lo parent 3:1 limit 1000p
qdisc drr 3: dev lo parent 1:2
step10. trigger the bug <=== prevented by this patch tc qdisc replace dev lo parent 1:3 handle 4:0
step 11. Redisplay again the qdiscs/classes
tc class ls dev lo
class drr 1:1 root leaf 2: quantum 64Kb
class drr 1:2 root leaf 3: quantum 64Kb
class drr 1:3 root leaf 4: quantum 64Kb
class drr 3:1 root leaf 4: quantum 64Kb
tc qdisc ls
qdisc drr 1: dev lo root refcnt 2
qdisc plug 2: dev lo parent 1:1
qdisc pfifo 4: dev lo parent 3:1 refcnt 2 limit 1000p qdisc drr 3: dev lo parent 1:2
Observe that a) parent for 4:0 does not change despite the replace request. There can only be one parent. b) refcount has gone up by two for 4:0 and
c) both class 1:3 and 3:1 are pointing to it.
Step 12. send one packet to plug
echo "" | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888,priority=$((0x10001)) step13. send one packet to the grafted fifo
echo "" | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888,priority=$((0x10003))
step14. lets trigger the uaf
tc class delete dev lo classid 1:3
tc class delete dev lo classid 1:1
The semantics of "replace" is for a del/add _on the same node_ and not a delete from one node(3:1) and add to another node (1:3) as in step10. While we could "fix" with a more complex approach there could be consequences to expectations so the patch takes the preventive approach of "disallow such config".
Joint work with Lion Ackermann <[email protected]>
--- net/sched/sch_api.c | 4 ++++ 1 file changed, 4 insertions(+)
net/sched/sch_api.c +4 -0
@@ -1664,6 +1664,10 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, q =qdisc_lookup (dev, tcm->tcm_handle);if (!q) goto create_n_graft; +if (q->parent != tcm->tcm_parent) { +NL_SET_ERR_MSG (extack,"Cannot move an existing qdisc to a different parent" ); +return -EINVAL ; + }if (n->nlmsg_flags &NLM_F_EXCL ) {NL_SET_ERR_MSG (extack,"Exclusivity flag on, cannot override" );return -EEXIST ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/623 netfilter: nf_tables: fix set size with rbtree backend
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 8d738c1869f611955d91d8d0fd0012d9ef207201 ]
The existing rbtree implementation uses singleton elements to represent ranges, however, userspace provides a set size according to the number of ranges in the set.
Adjust provided userspace set size to the number of singleton elements in the kernel by multiplying the range by two.
Check if the no-match all-zero element is already in the set, in such case release one slot in the set size.
--- include/net/netfilter/nf_tables.h | 6 ++++ net/netfilter/nf_tables_api.c | 49 +++++++++++++++++++++++++++++-- net/netfilter/nft_set_rbtree.c | 43 +++++++++++++++++++++++++++ 3 files changed, 96 insertions(+), 2 deletions(-)
include/net/netfilter/nf_tables.h +6 -0
@@ -442,6 +442,9 @@ struct nft_set_ext;* @remove: remove element from set * @walk: iterate over all set elements * @get: get set elements +* @ksize: kernel set size +* @usize: userspace set size +* @adjust_maxsize: delta to adjust maximum set size * @commit: commit set elements * @abort: abort set elements * @privsize: function to return size of set private data
@@ -495,6 +498,9 @@ struct nft_set_ops {const struct nft_set *set, const struct nft_set_elem *elem, unsigned int flags); +u32 (*ksize)(u32 size); +u32 (*usize)(u32 size); +u32 (*adjust_maxsize)(const struct nft_set *set);void (*commit)(struct nft_set *set);void (*abort)(const struct nft_set *set); u64 (*privsize)(const struct nlattr * const nla[],
net/netfilter/nf_tables_api.c +47 -2
91 lines not on this page · raw message
net/netfilter/nft_set_rbtree.c +43 -0
54 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/623 netfilter: nft_flow_offload: update tcp state flags under lock
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 7a4b61406395291ffb7220a10e8951a9a8684819 ]
The conntrack entry is already public, there is a small chance that another CPU is handling a packet in reply direction and racing with the tcp state update.
Move this under ct spinlock.
This is done once, when ct is about to be offloaded, so this should not result in a noticeable performance hit.
--- net/netfilter/nft_flow_offload.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
net/netfilter/nft_flow_offload.c +11 -5
@@ -289,6 +289,15 @@ static bool nft_flow_offload_skip(struct sk_buff *skb, int family)return false; } +static void flow_offload_ct_tcp (struct nf_conn *ct) +{ +/* conntrack will not see all packets, disable tcp window validation. */ +spin_lock_bh (&ct->lock); + ct->proto.tcp.seen[0 ].flags |=IP_CT_TCP_FLAG_BE_LIBERAL ; + ct->proto.tcp.seen[1 ].flags |=IP_CT_TCP_FLAG_BE_LIBERAL ; +spin_unlock_bh (&ct->lock); +} +static void nft_flow_offload_eval (const struct nft_expr *expr,struct nft_regs *regs,const struct nft_pktinfo *pkt)
@@ -356,11 +365,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, goto err_flow_alloc;flow_offload_route_init (flow, &route); - -if (tcph) { - ct->proto.tcp.seen[0 ].flags |=IP_CT_TCP_FLAG_BE_LIBERAL ; - ct->proto.tcp.seen[1 ].flags |=IP_CT_TCP_FLAG_BE_LIBERAL ; - } +if (tcph) +flow_offload_ct_tcp (ct);__set_bit (NF_FLOW_HW_BIDIRECTIONAL , &flow->flags); ret =flow_offload_add (flowtable, flow);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/623 net: sched: refine software bypass handling in tc_run
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit a12c76a03386e32413ae8eaaefa337e491880632 ]
This patch addresses issues with filter counting in block (tcf_block), particularly for software bypass scenarios, by introducing a more accurate mechanism using useswcnt.
Previously, filtercnt and skipswcnt were introduced by:
Commit 2081fd3445fe ("net: sched: cls_api: add filter counter") and Commit f631ef39d819 ("net: sched: cls_api: add skip_sw counter")
filtercnt tracked all tp (tcf_proto) objects added to a block, and skipswcnt counted tp objects with the skipsw attribute set.
The problem is: a single tp can contain multiple filters, some with skipsw and others without. The current implementation fails in the case:
When the first filter in a tp has skipsw, both skipswcnt and filtercnt are incremented, then adding a second filter without skipsw to the same tp does not modify these counters because tp->counted is already set.
This results in bypass software behavior based solely on skipswcnt equaling filtercnt, even when the block includes filters without skipsw. Consequently, filters without skipsw are inadvertently bypassed.
To address this, the patch introduces useswcnt in block to explicitly count tp objects containing at least one filter without skipsw. Key changes include:
Whenever a filter without skipsw is added, its tp is marked with usesw and counted in useswcnt. tc_run() now uses useswcnt to determine software bypass, eliminating reliance on filtercnt and skipswcnt.
This refined approach prevents software bypass for blocks containing mixed filters, ensuring correct behavior in tc_run().
Additionally, as atomic operations on useswcnt ensure thread safety and tp->lock guards access to tp->usesw and tp->counted, the broader lock down_write(&block->cb_lock) is no longer required in tc_new_tfilter(), and this resolves a performance regression caused by the filter counting mechanism during parallel filter insertions.
The improvement can be demonstrated using the following script:
# cat insert_tc_rules.sh
tc qdisc add dev ens1f0np0 ingress
for i in $(seq 16); do
taskset -c $i tc -b rules_$i.txt &
done
wait
Each of rules_$i.txt files above includes 100000 tc filter rules to a mlx5 driver NIC ens1f0np0.
Without this patch:
# time sh insert_tc_rules.sh
real 0m50.780s
user 0m23.556s
sys 4m13.032sWith this patch:
# time sh insert_tc_rules.sh
real 0m17.718s
user 0m7.807s
sys 3m45.050s--- include/net/pkt_cls.h | 13 +++++++-- include/net/sch_generic.h | 5 ++-- net/core/dev.c | 15 ++++++----- net/sched/cls_api.c | 57 ++++++++++++++++----------------------- net/sched/cls_bpf.c | 2 ++ net/sched/cls_flower.c | 2 ++ net/sched/cls_matchall.c | 2 ++ net/sched/cls_u32.c | 4 +++ 8 files changed, 55 insertions(+), 45 deletions(-)
include/net/pkt_cls.h +11 -2
@@ -75,11 +75,11 @@ static inline bool tcf_block_non_null_shared(struct tcf_block *block) }#ifdef CONFIG_NET_CLS_ACT -DECLARE_STATIC_KEY_FALSE (tcf_bypass_check_needed_key); +DECLARE_STATIC_KEY_FALSE (tcf_sw_enabled_key);static inline bool tcf_block_bypass_sw (struct tcf_block *block) { -return block && block->bypass_wanted; +return block && !atomic_read (&block->useswcnt); }#endif
@@ -760,6 +760,15 @@ tc_cls_common_offload_init(struct flow_cls_common_offload *cls_common, cls_common->extack = extack; } +static inline void tcf_proto_update_usesw (struct tcf_proto *tp,u32 flags) +{ +if (tp->usesw) +return ; +if (tc_skip_sw (flags) &&tc_in_hw (flags)) +return ; + tp->usesw = true; +} +#if IS_ENABLED (CONFIG_NET_TC_SKB_EXT )static inline struct tc_skb_ext *tc_skb_ext_alloc (struct sk_buff *skb) {
include/net/sch_generic.h +2 -3
@@ -425,6 +425,7 @@ struct tcf_proto {spinlock_t lock;bool deleting;bool counted; +bool usesw;refcount_t refcnt;struct rcu_head rcu;struct hlist_node destroy_ht_node;
@@ -474,9 +475,7 @@ struct tcf_block {struct flow_block flow_block;struct list_head owner_list;bool keep_dst; -bool bypass_wanted; -atomic_t filtercnt;/* Number of filters */ -atomic_t skipswcnt;/* Number of skip_sw filters */ +atomic_t useswcnt;atomic_t offloadcnt;/* Number of oddloaded filters */ unsigned int nooffloaddevcnt;/* Number of devs unable to do offload */ unsigned int lockeddevcnt;/* Number of devs that require rtnl lock. */
net/core/dev.c +9 -6
@@ -2136,8 +2136,8 @@ EXPORT_SYMBOL_GPL(net_dec_egress_queue);#endif #ifdef CONFIG_NET_CLS_ACT -DEFINE_STATIC_KEY_FALSE (tcf_bypass_check_needed_key); -EXPORT_SYMBOL (tcf_bypass_check_needed_key); +DEFINE_STATIC_KEY_FALSE (tcf_sw_enabled_key); +EXPORT_SYMBOL (tcf_sw_enabled_key);#endif DEFINE_STATIC_KEY_FALSE (netstamp_needed_key);
@@ -4032,10 +4032,13 @@ static int tc_run(struct tcx_entry *entry, struct sk_buff *skb,if (!miniq)return ret; -if (static_branch_unlikely (&tcf_bypass_check_needed_key)) { -if (tcf_block_bypass_sw (miniq->block)) -return ret; - } +/* Global bypass */ +if (!static_branch_likely (&tcf_sw_enabled_key)) +return ret; + +/* Block-wise bypass */ +if (tcf_block_bypass_sw (miniq->block)) +return ret;tc_skb_cb (skb)->mru =0 ;tc_skb_cb (skb)->post_ct = false;
net/sched/cls_api.c +23 -34
98 lines not on this page · raw message
net/sched/cls_bpf.c +2 -0
@@ -509,6 +509,8 @@ static int cls_bpf_change(struct net *net, struct sk_buff *in_skb,if (!tc_in_hw (prog->gen_flags)) prog->gen_flags |=TCA_CLS_FLAGS_NOT_IN_HW ; +tcf_proto_update_usesw (tp, prog->gen_flags); +if (oldprog) {idr_replace (&head->handle_idr, prog, handle);list_replace_rcu (&oldprog->link, &prog->link);
net/sched/cls_flower.c +2 -0
@@ -2503,6 +2503,8 @@ static int fl_change(struct net *net, struct sk_buff *in_skb,if (!tc_in_hw (fnew->flags)) fnew->flags |=TCA_CLS_FLAGS_NOT_IN_HW ; +tcf_proto_update_usesw (tp, fnew->flags); +spin_lock (&tp->lock);/* tp was deleted concurrently. -EAGAIN will cause caller to lookup
net/sched/cls_matchall.c +2 -0
@@ -228,6 +228,8 @@ static int mall_change(struct net *net, struct sk_buff *in_skb,if (!tc_in_hw (new->flags)) new->flags |=TCA_CLS_FLAGS_NOT_IN_HW ; +tcf_proto_update_usesw (tp, new->flags); + *arg = head;rcu_assign_pointer (tp->root, new);return 0 ;
net/sched/cls_u32.c +4 -0
@@ -951,6 +951,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,if (!tc_in_hw (new->flags)) new->flags |=TCA_CLS_FLAGS_NOT_IN_HW ; +tcf_proto_update_usesw (tp, new->flags); +u32_replace_knode (tp, tp_c, new);tcf_unbind_filter (tp, &n->res);tcf_exts_get_net (&n->exts);
@@ -1164,6 +1166,8 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,if (!tc_in_hw (n->flags)) n->flags |=TCA_CLS_FLAGS_NOT_IN_HW ; +tcf_proto_update_usesw (tp, n->flags); + ins = &ht->ht[TC_U32_HASH (handle)];for (pins =rtnl_dereference (*ins); pins; ins = &pins->next, pins =rtnl_dereference (*ins))
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/623 net: ethernet: ti: am65-cpsw: fix freeing IRQ in am65_cpsw_nuss_remove_tx_chns()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
[ Upstream commit 4395a44acb15850e492dd1de9ec4b6479d96bc80 ]
When getting the IRQ we use k3_udma_glue_tx_get_irq() which returns negative error value on error. So not NULL check is not sufficient to deteremine if IRQ is valid. Check that IRQ is greater then zero to ensure it is valid.
There is no issue at probe time but at runtime user can invoke .set_channels which results in the following call chain. am65_cpsw_set_channels()
am65_cpsw_nuss_update_tx_rx_chns()
am65_cpsw_nuss_remove_tx_chns() am65_cpsw_nuss_init_tx_chns()
At this point if am65_cpsw_nuss_init_tx_chns() fails due to k3_udma_glue_tx_get_irq() then tx_chn->irq will be set to a negative value.
Then, at subsequent .set_channels with higher channel count we will attempt to free an invalid IRQ in am65_cpsw_nuss_remove_tx_chns() leading to a kernel warning.
The issue is present in the original commit that introduced this driver, although there, am65_cpsw_nuss_update_tx_rx_chns() existed as am65_cpsw_nuss_update_tx_chns().
--- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/am65-cpsw-nuss.c +1 -1
@@ -2248,7 +2248,7 @@ static void am65_cpsw_nuss_remove_tx_chns(struct am65_cpsw_common *common)for (i =0 ; i < common->tx_ch_num; i++) {struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i]; -if (tx_chn->irq) +if (tx_chn->irq >0 )devm_free_irq (dev, tx_chn->irq, tx_chn);netif_napi_del (&tx_chn->napi_tx);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/623 tcp_cubic: fix incorrect HyStart round start detection
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mahdi Arghavani <[email protected]>
[ Upstream commit 25c1a9ca53db5780757e7f53e688b8f916821baa ]
I noticed that HyStart incorrectly marks the start of rounds, leading to inaccurate measurements of ACK train lengths and resetting the ca->sample_cnt variable. This inaccuracy can impact HyStart's functionality in terminating exponential cwnd growth during Slow-Start, potentially degrading TCP performance.
The issue arises because the changes introduced in commit 4e1fddc98d25 ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") moved the caller of the bictcp_hystart_reset function inside the hystart_update function. This modification added an additional condition for triggering the caller, requiring that (tcp_snd_cwnd(tp) >= hystart_low_window) must also
be satisfied before invoking bictcp_hystart_reset.
This fix ensures that bictcp_hystart_reset is correctly called at the start of a new round, regardless of the congestion window size. This is achieved by moving the condition
(tcp_snd_cwnd(tp) >= hystart_low_window)
from before calling bictcp_hystart_reset to after it.
I tested with a client and a server connected through two Linux software routers. In this setup, the minimum RTT was 150 ms, the bottleneck bandwidth was 50 Mbps, and the bottleneck buffer size was 1 BDP, calculated as (50M / 1514 / 8) * 0.150 = 619 packets. I conducted the test twice, transferring data from the server to the client for 1.5 seconds. Before the patch was applied, HYSTART-DELAY stopped the exponential growth of cwnd when cwnd = 516, and the bottleneck link was not yet saturated (516 < 619).
After the patch was applied, HYSTART-ACK-TRAIN stopped the exponential growth of cwnd when cwnd = 632, and the bottleneck link was saturated (632 > 619).
In this test, applying the patch resulted in 300 KB more data delivered.
--- net/ipv4/tcp_cubic.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/ipv4/tcp_cubic.c +5 -3
@@ -392,6 +392,10 @@ static void hystart_update(struct sock *sk, u32 delay)if (after (tp->snd_una, ca->end_seq))bictcp_hystart_reset (sk); +/* hystart triggers when cwnd is larger than some threshold */ +if (tcp_snd_cwnd (tp) < hystart_low_window) +return ; +if (hystart_detect &HYSTART_ACK_TRAIN ) {u32 now =bictcp_clock_us (sk);
@@ -467,9 +471,7 @@ __bpf_kfunc static void cubictcp_acked(struct sock *sk, const struct ack_sampleif (ca->delay_min ==0 || ca->delay_min > delay) ca->delay_min = delay; -/* hystart triggers when cwnd is larger than some threshold */ -if (!ca->found &&tcp_in_slow_start (tp) && hystart && -tcp_snd_cwnd (tp) >= hystart_low_window) +if (!ca->found &&tcp_in_slow_start (tp) && hystart)hystart_update (sk, delay); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/623 net/rose: prevent integer overflows in rose_setsockopt()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit d640627663bfe7d8963c7615316d7d4ef60f3b0b ]
In case of possible unpredictably large arguments passed to rose_setsockopt() and multiplied by extra values on top of that, integer overflows may occur.
Do the safest minimum and fix these issues by checking the contents of 'opt' and returning -EINVAL if they are too large. Also, switch to unsigned int and remove useless check for negative 'opt' in ROSE_IDLE case.
--- net/rose/af_rose.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/rose/af_rose.c +8 -8
@@ -397,15 +397,15 @@ static int rose_setsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk;struct rose_sock *rose =rose_sk (sk); -int opt; +unsigned int opt;if (level !=SOL_ROSE )return -ENOPROTOOPT ; -if (optlen <sizeof (int )) +if (optlen <sizeof (unsigned int ))return -EINVAL ; -if (copy_from_sockptr (&opt, optval,sizeof (int ))) +if (copy_from_sockptr (&opt, optval,sizeof (unsigned int )))return -EFAULT ;switch (optname) {
@@ -414,31 +414,31 @@ static int rose_setsockopt(struct socket *sock, int level, int optname,return 0 ;case ROSE_T1 : -if (opt <1 ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; rose->t1 = opt *HZ ;return 0 ;case ROSE_T2 : -if (opt <1 ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; rose->t2 = opt *HZ ;return 0 ;case ROSE_T3 : -if (opt <1 ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; rose->t3 = opt *HZ ;return 0 ;case ROSE_HOLDBACK : -if (opt <1 ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; rose->hb = opt *HZ ;return 0 ;case ROSE_IDLE : -if (opt <0 ) +if (opt >UINT_MAX / (60 *HZ ))return -EINVAL ; rose->idle = opt *60 *HZ ;return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/623 platform/mellanox: mlxbf-pmc: incorrect type in assignment
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit b5dbb8e23cb334460acdb37910ce3784926e1cf1 ]
Fix sparse warnings:
expected 'void __iomem *addr', but got 'void *addr'
--- drivers/platform/mellanox/mlxbf-pmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/platform/mellanox/mlxbf-pmc.c +3 -3
@@ -1168,7 +1168,7 @@ static int mlxbf_pmc_program_l3_counter(unsigned int blk_num, u32 cnt_num, u32 e/* Method to handle crspace counter programming */ static int mlxbf_pmc_program_crspace_counter (unsigned int blk_num,u32 cnt_num,u32 evt) { -void *addr; +void __iomem *addr;u32 word;int ret;
@@ -1192,7 +1192,7 @@ static int mlxbf_pmc_program_crspace_counter(unsigned int blk_num, u32 cnt_num,/* Method to clear crspace counter value */ static int mlxbf_pmc_clear_crspace_counter (unsigned int blk_num,u32 cnt_num) { -void *addr; +void __iomem *addr; addr = pmc->block[blk_num].mmio_base + MLXBF_PMC_CRSPACE_PERFMON_VAL0(pmc->block[blk_num].counters) +
@@ -1405,7 +1405,7 @@ static int mlxbf_pmc_read_l3_event(unsigned int blk_num, u32 cnt_num, u64 *resulstatic int mlxbf_pmc_read_crspace_event (unsigned int blk_num,u32 cnt_num,u64 *result) {u32 word, evt; -void *addr; +void __iomem *addr;int ret; addr = pmc->block[blk_num].mmio_base +
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/623 platform/x86: x86-android-tablets: make platform data be static
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pei Xiao <[email protected]>
[ Upstream commit 6e0fb1bdb71cf8078c8532617e565e3db22c0d3c ]
make lenovo_yoga_tab2_1380_bq24190_pdata and lenovo_yoga_tab2_1380_modules to be static
--- drivers/platform/x86/x86-android-tablets/lenovo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/x86-android-tablets/lenovo.c +2 -2
@@ -601,7 +601,7 @@ static const struct regulator_init_data lenovo_yoga_tab2_1380_bq24190_vbus_init_ .num_consumer_supplies = 1, }; -struct bq24190_platform_data lenovo_yoga_tab2_1380_bq24190_pdata = { +static struct bq24190_platform_data lenovo_yoga_tab2_1380_bq24190_pdata = { .regulator_init_data = &lenovo_yoga_tab2_1380_bq24190_vbus_init_data, };
@@ -726,7 +726,7 @@ static const struct platform_device_info lenovo_yoga_tab2_1380_pdevs[] __initcon }, }; -const char *const lenovo_yoga_tab2_1380_modules[]__initconst = { +static const char *const lenovo_yoga_tab2_1380_modules[]__initconst = {"bq24190_charger" ,/* For the Vbus regulator for lc824206xa */ NULL };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/623 pinctrl: samsung: Fix irq handling if an error occurs in exynos_irq_demux_eint16_31()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit f686a2b52e9d78cf401f1b7f446bf0c3a81ebcc0 ]
chained_irq_enter(() should be paired with a corresponding chained_irq_exit().
Here, if clk_enable() fails, a early return occurs and chained_irq_exit() is not called.
Add a new label and a goto for fix it.
--- drivers/pinctrl/samsung/pinctrl-exynos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pinctrl/samsung/pinctrl-exynos.c +2 -1
@@ -636,7 +636,7 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc)if (clk_enable (b->drvdata->pclk)) {dev_err (b->gpio_chip.parent,"unable to enable clock for pending IRQs\n" ); -return ; + goto out; } }
@@ -652,6 +652,7 @@ static void exynos_irq_demux_eint16_31(struct irq_desc *desc)if (eintd->nr_banks)clk_disable (eintd->banks[0 ]->drvdata->pclk); +out:chained_irq_exit (chip, desc); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/623 libbpf: dont adjust USDT semaphore address if .stapsdt.base addr is missing
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrii Nakryiko <[email protected]>
[ Upstream commit 98ebe5ef6f5c4517ba92fb3e56f95827ebea83fd ]
USDT ELF note optionally can record an offset of .stapsdt.base, which is used to make adjustments to USDT target attach address. Currently, libbpf will do this address adjustment unconditionally if it finds .stapsdt.base ELF section in target binary. But there is a corner case where .stapsdt.base ELF section is present, but specific USDT note doesn't reference it. In such case, libbpf will basically just add base address and end up with absolutely incorrect USDT target address.
This adjustment has to be done only if both .stapsdt.sema section is present and USDT note is recording a reference to it.
--- tools/lib/bpf/usdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/usdt.c +1 -1
@@ -661,7 +661,7 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char ** [0] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation */ usdt_abs_ip = note.loc_addr; -if (base_addr) +if (base_addr && note.base_addr) usdt_abs_ip += base_addr - note.base_addr;/* When attaching uprobes (which is what USDTs basically are)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 249/623 ASoC: cs40l50: Use *-y for Makefile
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 3f0b8d367db5b0c0a0096b1c2ff02ec7c5c893b6 ]
We should use *-y instead of *-objs in Makefile for the module objects. *-objs is used rather for host programs.
--- sound/soc/codecs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/Makefile +1 -1
@@ -80,7 +80,7 @@ snd-soc-cs35l56-shared-y := cs35l56-shared.o snd-soc-cs35l56-i2c-y := cs35l56-i2c.o snd-soc-cs35l56-spi-y := cs35l56-spi.o snd-soc-cs35l56-sdw-y := cs35l56-sdw.o -snd-soc-cs40l50-objs := cs40l50-codec.o +snd-soc-cs40l50-y := cs40l50-codec.o snd-soc-cs42l42-y := cs42l42.o snd-soc-cs42l42-i2c-y := cs42l42-i2c.o snd-soc-cs42l42-sdw-y := cs42l42-sdw.o
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 250/623 ASoC: mediatek: mt8365: Use *-y for Makefile
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit e9d2a2f49244d9737f0ec33f4b7f3580faecd805 ]
We should use *-y instead of *-objs in Makefile for the module objects. *-objs is used rather for host programs.
--- sound/soc/mediatek/mt8365/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/mediatek/mt8365/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # MTK Platform driver -snd-soc-mt8365-pcm-objs := \ +snd-soc-mt8365-pcm-y := \ mt8365-afe-clk.o \ mt8365-afe-pcm.o \ mt8365-dai-adda.o \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 251/623 ASoC: SDCA: Use *-y for Makefile
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit f60646d9c3bd5b390728ed1a1caa9ded53d47afc ]
We should use *-y instead of *-objs in Makefile for the module objects. *-objs is used rather for host programs.
--- sound/soc/sdca/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sdca/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -snd-soc-sdca-objs := sdca_functions.o sdca_device.o +snd-soc-sdca-y := sdca_functions.o sdca_device.o obj-$(CONFIG_SND_SOC_SDCA) += snd-soc-sdca.o
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 252/623 ASoC: cs42l84: Use *-y for Makefile
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 7916a8d8782d4e53fe0133c8dace20a925e0204e ]
We should use *-y instead of *-objs in Makefile for the module objects. *-objs is used rather for host programs.
--- sound/soc/codecs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/Makefile +1 -1
@@ -92,7 +92,7 @@ snd-soc-cs42l52-y := cs42l52.o snd-soc-cs42l56-y := cs42l56.o snd-soc-cs42l73-y := cs42l73.o snd-soc-cs42l83-i2c-y := cs42l83-i2c.o -snd-soc-cs42l84-objs := cs42l84.o +snd-soc-cs42l84-y := cs42l84.o snd-soc-cs4234-y := cs4234.o snd-soc-cs4265-y := cs4265.o snd-soc-cs4270-y := cs4270.o
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 253/623 ASoC: wcd937x: Use *-y for Makefile
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
[ Upstream commit 582057d2233a5a38e1aec3f4a6d66b362b42076c ]
We should use *-y instead of *-objs in Makefile for the module objects. *-objs is used rather for host programs.
--- sound/soc/codecs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/Makefile +2 -2
@@ -334,8 +334,8 @@ snd-soc-wcd-classh-y := wcd-clsh-v2.o snd-soc-wcd-mbhc-y := wcd-mbhc-v2.o snd-soc-wcd9335-y := wcd9335.o snd-soc-wcd934x-y := wcd934x.o -snd-soc-wcd937x-objs := wcd937x.o -snd-soc-wcd937x-sdw-objs := wcd937x-sdw.o +snd-soc-wcd937x-y := wcd937x.o +snd-soc-wcd937x-sdw-y := wcd937x-sdw.o snd-soc-wcd938x-y := wcd938x.o snd-soc-wcd938x-sdw-y := wcd938x-sdw.o snd-soc-wcd939x-y := wcd939x.o
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 254/623 tools/testing/selftests/bpf/test_tc_tunnel.sh: Fix wait for server bind
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Leogrande <[email protected]>
[ Upstream commit e2f0791124a1b6ca8d570110cbd487969d9d41ef ]
Commit f803bcf9208a ("selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh") added code that waits for the netcat server to start before the netcat client attempts to connect to it. However, not all calls to 'server_listen' were guarded.
This patch adds the existing 'wait_for_port' guard after the remaining call to 'server_listen'.
--- tools/testing/selftests/bpf/test_tc_tunnel.sh | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/test_tc_tunnel.sh +1 -0
@@ -305,6 +305,7 @@ else client_connect verify_data server_listen + wait_for_port ${port} ${netcat_opt} fi # serverside, use BPF for decap
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 255/623 sched_ext: Use the NUMA scheduling domain for NUMA optimizations
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Righi <[email protected]>
[ Upstream commit 4572541892ea4e1dade2e9c1313d3f8069d37f0a ]
Rely on the NUMA scheduling domain topology, instead of accessing NUMA topology information directly.
There is basically no functional change, but in this way we ensure consistent use of the same topology information determined by the scheduling subsystem.
--- kernel/sched/ext.c | 114 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 86 insertions(+), 28 deletions(-)
kernel/sched/ext.c +86 -28
@@ -3219,6 +3219,74 @@ static s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, u64 flags) goto retry; } +/* +* Return the amount of CPUs in the same LLC domain of @cpu (or zero if the LLC +* domain is not defined). +*/ +static unsigned int llc_weight (s32 cpu) +{ +struct sched_domain *sd; + + sd =rcu_dereference (per_cpu (sd_llc, cpu)); +if (!sd) +return 0 ; + +return sd->span_weight; +} + +/* +* Return the cpumask representing the LLC domain of @cpu (or NULL if the LLC +* domain is not defined). +*/ +static struct cpumask *llc_span (s32 cpu) +{ +struct sched_domain *sd; + + sd =rcu_dereference (per_cpu (sd_llc, cpu)); +if (!sd) +return 0 ; + +return sched_domain_span (sd); +} + +/* +* Return the amount of CPUs in the same NUMA domain of @cpu (or zero if the +* NUMA domain is not defined). +*/ +static unsigned int numa_weight (s32 cpu) +{ +struct sched_domain *sd; +struct sched_group *sg; + + sd =rcu_dereference (per_cpu (sd_numa, cpu)); +if (!sd) +return 0 ; + sg = sd->groups; +if (!sg) +return 0 ; + +return sg->group_weight; +} + +/* +* Return the cpumask representing the NUMA domain of @cpu (or NULL if the NUMA +* domain is not defined). +*/ +static struct cpumask *numa_span (s32 cpu) +{ +struct sched_domain *sd; +struct sched_group *sg; + + sd =rcu_dereference (per_cpu (sd_numa, cpu)); +if (!sd) +return NULL ; + sg = sd->groups; +if (!sg) +return NULL ; + +return sched_group_span (sg); +} +/* * Return true if the LLC domains do not perfectly overlap with the NUMA * domains, false otherwise.
@@ -3250,19 +3318,10 @@ static bool llc_numa_mismatch(void)* overlapping, which is incorrect (as NUMA 1 has two distinct LLC * domains). */ -for_each_online_cpu (cpu) { -const struct cpumask *numa_cpus; -struct sched_domain *sd; - - sd =rcu_dereference (per_cpu (sd_llc, cpu)); -if (!sd) +for_each_online_cpu (cpu) +if (llc_weight (cpu) !=numa_weight (cpu))return true; - numa_cpus =cpumask_of_node (cpu_to_node (cpu)); -if (sd->span_weight !=cpumask_weight (numa_cpus)) -return true; - } -return false; }
@@ -3280,8 +3339,7 @@ static bool llc_numa_mismatch(void)static void update_selcpu_topology (void ) {bool enable_llc = false, enable_numa = false; -struct sched_domain *sd; -const struct cpumask *cpus; +unsigned int nr_cpus;s32 cpu =cpumask_first (cpu_online_mask);/*
@@ -3295,10 +3353,12 @@ static void update_selcpu_topology(void)* CPUs. */ rcu_read_lock (); - sd =rcu_dereference (per_cpu (sd_llc, cpu)); -if (sd) { -if (sd->span_weight <num_online_cpus ()) + nr_cpus =llc_weight (cpu); +if (nr_cpus >0 ) { +if (nr_cpus <num_online_cpus ()) enable_llc = true; +pr_debug ("sched_ext: LLC=%*pb weight=%u\n" , +cpumask_pr_args (llc_span (cpu)),llc_weight (cpu)); }/*
@@ -3310,9 +3370,13 @@ static void update_selcpu_topology(void)* enabling both NUMA and LLC optimizations is unnecessary, as checking * for an idle CPU in the same domain twice is redundant. */ - cpus =cpumask_of_node (cpu_to_node (cpu)); -if ((cpumask_weight (cpus) <num_online_cpus ()) &&llc_numa_mismatch ()) - enable_numa = true; + nr_cpus =numa_weight (cpu); +if (nr_cpus >0 ) { +if (nr_cpus <num_online_cpus () &&llc_numa_mismatch ()) + enable_numa = true; +pr_debug ("sched_ext: NUMA=%*pb weight=%u\n" , +cpumask_pr_args (numa_span (cpu)),numa_weight (cpu)); + }rcu_read_unlock (); pr_debug("sched_ext: LLC idle selection %s\n",
@@ -3364,7 +3428,6 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu, *found = false; -/* * This is necessary to protect llc_cpus. */
@@ -3383,15 +3446,10 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu,*/ if (p->nr_cpus_allowed >=num_possible_cpus ()) {if (static_branch_maybe (CONFIG_NUMA , &scx_selcpu_topo_numa)) - numa_cpus =cpumask_of_node (cpu_to_node (prev_cpu)); - -if (static_branch_maybe (CONFIG_SCHED_MC , &scx_selcpu_topo_llc)) { -struct sched_domain *sd; + numa_cpus =numa_span (prev_cpu); - sd =rcu_dereference (per_cpu (sd_llc, prev_cpu)); -if (sd) - llc_cpus =sched_domain_span (sd); - } +if (static_branch_maybe (CONFIG_SCHED_MC , &scx_selcpu_topo_llc)) + llc_cpus =llc_span (prev_cpu); }/*
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 256/623 libbpf: Fix segfault due to libelf functions not setting errno
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quentin Monnet <[email protected]>
[ Upstream commit e10500b69c3f3378f3dcfc8c2fe4cdb74fc844f5 ]
Libelf functions do not set errno on failure. Instead, it relies on its internal _elf_errno value, that can be retrieved via elf_errno (or the corresponding message via elf_errmsg()). From "man libelf":
If a libelf function encounters an error it will set an internal error code that can be retrieved with elf_errno. Each thread maintains its own separate error code. The meaning of each error code can be determined with elf_errmsg, which returns a string describing the error.
As a consequence, libbpf should not return -errno when a function from libelf fails, because an empty value will not be interpreted as an error and won't prevent the program to stop. This is visible in bpf_linker__add_file(), for example, where we call a succession of functions that rely on libelf:
err = err ?: linker_load_obj_file(linker, filename, opts, &obj);
err = err ?: linker_append_sec_data(linker, &obj);
err = err ?: linker_append_elf_syms(linker, &obj);
err = err ?: linker_append_elf_relos(linker, &obj);
err = err ?: linker_append_btf(linker, &obj);
err = err ?: linker_append_btf_ext(linker, &obj);If the object file that we try to process is not, in fact, a correct object file, linker_load_obj_file() may fail with errno not being set, and return 0. In this case we attempt to run linker_append_elf_sysms() and may segfault.
This can happen (and was discovered) with bpftool:
$ bpftool gen object output.o sample_ret0.bpf.c
libbpf: failed to get ELF header for sample_ret0.bpf.c: invalid `Elf' handle
zsh: segmentation fault (core dumped) bpftool gen object output.o sample_ret0.bpf.cFix the issue by returning a non-null error code (-EINVAL) when libelf functions fail.
--- tools/lib/bpf/linker.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-)
tools/lib/bpf/linker.c +8 -14
@@ -566,17 +566,15 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, } obj->elf =elf_begin (obj->fd,ELF_C_READ_MMAP ,NULL );if (!obj->elf) { - err = -errno;pr_warn_elf ("failed to parse ELF file '%s'" , filename); -return err; +return -EINVAL ; }/* Sanity check ELF file high-level properties */ ehdr =elf64_getehdr (obj->elf);if (!ehdr) { - err = -errno;pr_warn_elf ("failed to get ELF header for %s" , filename); -return err; +return -EINVAL ; }/* Linker output endianness set by first input object */
@@ -606,9 +604,8 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, }if (elf_getshdrstrndx (obj->elf, &obj->shstrs_sec_idx)) { - err = -errno;pr_warn_elf ("failed to get SHSTRTAB section index for %s" , filename); -return err; +return -EINVAL ; } scn =NULL ;
@@ -618,26 +615,23 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, shdr =elf64_getshdr (scn);if (!shdr) { - err = -errno;pr_warn_elf ("failed to get section #%zu header for %s" , sec_idx, filename); -return err; +return -EINVAL ; } sec_name =elf_strptr (obj->elf, obj->shstrs_sec_idx, shdr->sh_name);if (!sec_name) { - err = -errno;pr_warn_elf ("failed to get section #%zu name for %s" , sec_idx, filename); -return err; +return -EINVAL ; } data =elf_getdata (scn,0 );if (!data) { - err = -errno;pr_warn_elf ("failed to get section #%zu (%s) data from %s" , sec_idx, sec_name, filename); -return err; +return -EINVAL ; } sec =add_src_sec (obj, sec_name);
@@ -2680,14 +2674,14 @@ int bpf_linker__finalize(struct bpf_linker *linker)/* Finalize ELF layout */ if (elf_update (linker->elf,ELF_C_NULL ) <0 ) { - err = -errno; + err = -EINVAL ;pr_warn_elf ("failed to finalize ELF layout" );return libbpf_err (err); }/* Write out final ELF contents */ if (elf_update (linker->elf,ELF_C_WRITE ) <0 ) { - err = -errno; + err = -EINVAL ;pr_warn_elf ("failed to write ELF contents" );return libbpf_err (err); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 257/623 ASoC: Intel: sof_sdw: correct mach_params->dmic_num
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bard Liao <[email protected]>
[ Upstream commit 4ab80a2961c75562ffbac1f80de151a978c31659 ]
mach_params->dmic_num will be used to set the cfg-mics value of card->components string which should be the dmic channels. However dmic_num is dmic link number and could be set due to the SOC_SDW_PCH_DMIC quirk. Set mach_params->dmic_num to the default value if the dmic link is created due to the SOC_SDW_PCH_DMIC quirk.
--- sound/soc/intel/boards/sof_sdw.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-)
sound/soc/intel/boards/sof_sdw.c +14 -10
@@ -22,6 +22,8 @@ static int quirk_override = -1;module_param_named (quirk, quirk_override, int,0444 );MODULE_PARM_DESC (quirk,"Board-specific quirk override" ); +#define DMIC_DEFAULT_CHANNELS 2 +static void log_quirks (struct device *dev) {if (SOC_SDW_JACK_JDSRC (sof_sdw_quirk))
@@ -1127,17 +1129,19 @@ static int sof_card_dai_links_create(struct snd_soc_card *card) hdmi_num =SOF_PRE_TGL_HDMI_COUNT ;/* enable dmic01 & dmic16k */ -if (sof_sdw_quirk &SOC_SDW_PCH_DMIC || mach_params->dmic_num) { -if (ctx->ignore_internal_dmic) -dev_warn (dev,"Ignoring PCH DMIC\n" ); -else - dmic_num =2 ; +if (ctx->ignore_internal_dmic) { +dev_warn (dev,"Ignoring internal DMIC\n" ); + mach_params->dmic_num =0 ; + }else if (mach_params->dmic_num) { + dmic_num =2 ; + }else if (sof_sdw_quirk &SOC_SDW_PCH_DMIC ) { + dmic_num =2 ; +/* +* mach_params->dmic_num will be used to set the cfg-mics value of +* card->components string. Set it to the default value. +*/ + mach_params->dmic_num =DMIC_DEFAULT_CHANNELS ; } -/* -* mach_params->dmic_num will be used to set the cfg-mics value of card->components -* string. Overwrite it to the actual number of PCH DMICs used in the device. -*/ - mach_params->dmic_num = dmic_num;if (sof_sdw_quirk &SOF_SSP_BT_OFFLOAD_PRESENT ) bt_num =1 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 258/623 ASoC: sun4i-spdif: Add clock multiplier settings
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Lander <[email protected]>
[ Upstream commit 0a2319308de88b9e819c0b43d0fccd857123eb31 ]
There have been intermittent issues with the SPDIF output on H3 and H2+ devices which has been fixed by setting the s_clk to 4 times the audio pll.
Add a quirk for the clock multiplier as not every supported SoC requires it. Without the multiplier, the audio at normal sampling rates was distorted and did not play at higher sampling rates.
--- sound/soc/sunxi/sun4i-spdif.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/sunxi/sun4i-spdif.c +7 -0
@@ -176,6 +176,7 @@ struct sun4i_spdif_quirks {unsigned int reg_dac_txdata;bool has_reset;unsigned int val_fctl_ftx; +unsigned int mclk_multiplier; };struct sun4i_spdif_dev {
@@ -313,6 +314,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,default :return -EINVAL ; } + mclk *= host->quirks->mclk_multiplier; ret =clk_set_rate (host->spdif_clk, mclk);if (ret <0 ) {
@@ -347,6 +349,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream,default :return -EINVAL ; } + mclk_div *= host->quirks->mclk_multiplier; reg_val =0 ; reg_val |=SUN4I_SPDIF_TXCFG_ASS ;
@@ -540,24 +543,28 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = {static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = { .reg_dac_txdata =SUN4I_SPDIF_TXFIFO , .val_fctl_ftx =SUN4I_SPDIF_FCTL_FTX , + .mclk_multiplier =1 , };static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = { .reg_dac_txdata =SUN4I_SPDIF_TXFIFO , .val_fctl_ftx =SUN4I_SPDIF_FCTL_FTX , .has_reset = true, + .mclk_multiplier =1 , };static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = { .reg_dac_txdata =SUN8I_SPDIF_TXFIFO , .val_fctl_ftx =SUN4I_SPDIF_FCTL_FTX , .has_reset = true, + .mclk_multiplier =4 , };static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = { .reg_dac_txdata =SUN8I_SPDIF_TXFIFO , .val_fctl_ftx =SUN50I_H6_SPDIF_FCTL_FTX , .has_reset = true, + .mclk_multiplier =1 , };static const struct of_device_id sun4i_spdif_of_match[] = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 259/623 tools features: Dont check for libunwind devel files by default
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit 176c9d1e6a06f2fa62c1b9743369ab35c724d2c4 ]
Since 13e17c9ff49119aa ("perf build: Make libunwind opt-in rather than opt-out"), so we shouldn't by default be testing for its availability at build time in tools/build/features/test-all.c.
That test was designed to test the features we expect to be the most common ones in most builds, so if we test build just that file, then we assume the features there are present and will not test one by one.
Removing it from test-all.c gets rid of the first impediment for test-all.c to build successfully:
$ cat /tmp/build/perf-tools-next/feature/test-all.make.output
In file included from test-all.c:62:
test-libunwind.c:2:10: fatal error: libunwind.h: No such file or directory
2 | #include <libunwind.h>
| ^~~~~~~~~~~~~
compilation terminated.
$We then get to:
$ cat /tmp/build/perf-tools-next/feature/test-all.make.output /usr/bin/ld: cannot find -lunwind-x86_64: No such file or directory /usr/bin/ld: cannot find -lunwind: No such file or directory collect2: error: ld returned 1 exit status $
So make all the logic related to setting CFLAGS, LDFLAGS, etc for libunwind to be conditional on NO_LIBWUNWIND=1, which is now the default, now we get a faster build:
$ cat /tmp/build/perf-tools-next/feature/test-all.make.output $ ldd /tmp/build/perf-tools-next/feature/test-all.bin linux-vdso.so.1 (0x00007fef04cde000) libdw.so.1 => /lib64/libdw.so.1 (0x00007fef04a49000) libpython3.12.so.1.0 => /lib64/libpython3.12.so.1.0 (0x00007fef04478000) libm.so.6 => /lib64/libm.so.6 (0x00007fef04394000) libtraceevent.so.1 => /lib64/libtraceevent.so.1 (0x00007fef0436c000) libtracefs.so.1 => /lib64/libtracefs.so.1 (0x00007fef04345000) libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007fef03e95000) libz.so.1 => /lib64/libz.so.1 (0x00007fef03e72000) libelf.so.1 => /lib64/libelf.so.1 (0x00007fef03e56000) libnuma.so.1 => /lib64/libnuma.so.1 (0x00007fef03e48000) libslang.so.2 => /lib64/libslang.so.2 (0x00007fef03b65000) libperl.so.5.38 => /lib64/libperl.so.5.38 (0x00007fef037c6000) libc.so.6 => /lib64/libc.so.6 (0x00007fef035d5000) liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fef035a0000) libzstd.so.1 => /lib64/libzstd.so.1 (0x00007fef034e1000) libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fef034cd000) /lib64/ld-linux-x86-64.so.2 (0x00007fef04ce0000) libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007fef03495000) $
--- tools/build/feature/test-all.c | 5 -- tools/perf/Makefile.config | 83 ++++++++++++++++++++-------------- 2 files changed, 49 insertions(+), 39 deletions(-)
tools/build/feature/test-all.c +0 -5
@@ -58,10 +58,6 @@# include "test-libelf-getshdrstrndx.c" #undef main -#define main main_test_libunwind -# include "test-libunwind.c" -#undef main -#define main main_test_libslang# include "test-libslang.c" #undef main
@@ -184,7 +180,6 @@ int main(int argc, char *argv[])main_test_libelf_getphdrnum ();main_test_libelf_gelf_getnote ();main_test_libelf_getshdrstrndx (); -main_test_libunwind ();main_test_libslang ();main_test_libbfd ();main_test_libbfd_buildid ();
tools/perf/Makefile.config +49 -34
130 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 260/623 selftests/bpf: Fix fill_link_info selftest on powerpc
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Saket Kumar Bhaskar <[email protected]>
[ Upstream commit 4d33dc1bc31df80356c49e40dbd3ddff19500bcb ]
With CONFIG_KPROBES_ON_FTRACE enabled on powerpc, ftrace_location_range returns ftrace location for bpf_fentry_test1 at offset of 4 bytes from function entry. This is because branch to _mcount function is at offset of 4 bytes in function profile sequence.
To fix this, add entry_offset of 4 bytes while verifying the address for kprobe entry address of bpf_fentry_test1 in verify_perf_link_info in selftest, when CONFIG_KPROBES_ON_FTRACE is enabled.
Disassemble of bpf_fentry_test1:
c000000000e4b080 <bpf_fentry_test1>:
c000000000e4b080: a6 02 08 7c mflr r0 c000000000e4b084: b9 e2 22 4b bl c00000000007933c <_mcount> c000000000e4b088: 01 00 63 38 addi r3,r3,1 c000000000e4b08c: b4 07 63 7c extsw r3,r3 c000000000e4b090: 20 00 80 4e blr
When CONFIG_PPC_FTRACE_OUT_OF_LINE [1] is enabled, these function profile sequence is moved out of line with an unconditional branch at offset 0. So, the test works without altering the offset for 'CONFIG_KPROBES_ON_FTRACE && CONFIG_PPC_FTRACE_OUT_OF_LINE' case.
Disassemble of bpf_fentry_test1:
c000000000f95190 <bpf_fentry_test1>:
c000000000f95190: 00 00 00 60 nop c000000000f95194: 01 00 63 38 addi r3,r3,1 c000000000f95198: b4 07 63 7c extsw r3,r3 c000000000f9519c: 20 00 80 4e blr
[1] https://lore.kernel.org/all/[email protected]/
--- .../selftests/bpf/prog_tests/fill_link_info.c | 4 ++++ .../selftests/bpf/progs/test_fill_link_info.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/fill_link_info.c +4 -0
@@ -171,6 +171,10 @@ static void test_kprobe_fill_link_info(struct test_fill_link_info *skel,/* See also arch_adjust_kprobe_addr(). */ if (skel->kconfig->CONFIG_X86_KERNEL_IBT) entry_offset =4 ; +if (skel->kconfig->CONFIG_PPC64 && + skel->kconfig->CONFIG_KPROBES_ON_FTRACE && + !skel->kconfig->CONFIG_PPC_FTRACE_OUT_OF_LINE) + entry_offset =4 ; err =verify_perf_link_info (link_fd, type, kprobe_addr,0 , entry_offset);ASSERT_OK (err,"verify_perf_link_info" ); }else {
tools/testing/selftests/bpf/progs/test_fill_link_info.c +10 -3
@@ -6,13 +6,20 @@#include <stdbool.h> extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; +extern bool CONFIG_PPC_FTRACE_OUT_OF_LINE __kconfig __weak; +extern bool CONFIG_KPROBES_ON_FTRACE __kconfig __weak; +extern bool CONFIG_PPC64 __kconfig __weak; -/* This function is here to have CONFIG_X86_KERNEL_IBT -* used and added to object BTF. +/* This function is here to have CONFIG_X86_KERNEL_IBT, +* CONFIG_PPC_FTRACE_OUT_OF_LINE, CONFIG_KPROBES_ON_FTRACE, +* CONFIG_PPC6 used and added to object BTF. */ int unused (void ) { -return CONFIG_X86_KERNEL_IBT ?0 :1 ; +return CONFIG_X86_KERNEL_IBT || +CONFIG_PPC_FTRACE_OUT_OF_LINE || +CONFIG_KPROBES_ON_FTRACE || +CONFIG_PPC64 ?0 :1 ; }SEC ("kprobe" )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 261/623 iommu/arm-smmuv3: Update comments about ATS and bypass
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 9b640ae7fbba13d45a8b9712dff2911a0c2b5ff4 ]
The SMMUv3 spec has a note that BYPASS and ATS don't work together under the STE EATS field definition. However there is another section "13.6.4 Full ATS skipping stage 1" that explains under certain conditions BYPASS and ATS do work together if the STE is using S1DSS to select BYPASS and the CD table has the possibility for a substream.
When these comments were written the understanding was that all forms of BYPASS just didn't work and this was to be a future problem to solve.
It turns out that ATS and IDENTITY will always work just fine:
- If STE.Config = BYPASS then the PCI ATS is disabled
- If a PASID domain is attached then S1DSS = BYPASS and ATS will be enabled. This meets the requirements of 13.6.4 to automatically generate 1:1 ATS replies on the RID.
Update the comments to reflect this.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +12 -5
@@ -2745,9 +2745,14 @@ int arm_smmu_attach_prepare(struct arm_smmu_attach_state *state,* Translation Requests and Translated transactions are denied * as though ATS is disabled for the stream (STE.EATS == 0b00), * causing F_BAD_ATS_TREQ and F_TRANSL_FORBIDDEN events -* (IHI0070Ea 5.2 Stream Table Entry). Thus ATS can only be -* enabled if we have arm_smmu_domain, those always have page -* tables. +* (IHI0070Ea 5.2 Stream Table Entry). +* +* However, if we have installed a CD table and are using S1DSS +* then ATS will work in S1DSS bypass. See "13.6.4 Full ATS +* skipping stage 1". +* +* Disable ATS if we are going to create a normal 0b100 bypass +* STE. */ state->ats_enabled = !state->disable_ats &&arm_smmu_ats_supported (master);
@@ -3070,8 +3075,10 @@ static void arm_smmu_attach_dev_ste(struct iommu_domain *domain,if (arm_smmu_ssids_in_use (&master->cd_table)) {/* * If a CD table has to be present then we need to run with ATS -* on even though the RID will fail ATS queries with UR. This is -* because we have no idea what the PASID's need. +* on because we have to assume a PASID is using ATS. For +* IDENTITY this will setup things so that S1DSS=bypass which +* follows the explanation in "13.6.4 Full ATS skipping stage 1" +* and allows for ATS on the RID to work. */ state.cd_needs_ats = true;arm_smmu_attach_prepare (&state, domain);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 262/623 crypto: tegra - do not transfer req when tegra init fails
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ridong <[email protected]>
[ Upstream commit 15589bda46830695a3261518bb7627afac61f519 ]
The tegra_cmac_init or tegra_sha_init function may return an error when memory is exhausted. It should not transfer the request when they return an error.
--- drivers/crypto/tegra/tegra-se-aes.c | 7 +++++-- drivers/crypto/tegra/tegra-se-hash.c | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/crypto/tegra/tegra-se-aes.c +5 -2
@@ -1750,10 +1750,13 @@ static int tegra_cmac_digest(struct ahash_request *req)struct crypto_ahash *tfm =crypto_ahash_reqtfm (req);struct tegra_cmac_ctx *ctx =crypto_ahash_ctx (tfm);struct tegra_cmac_reqctx *rctx =ahash_request_ctx (req); +int ret; -tegra_cmac_init (req); - rctx->task |=SHA_UPDATE |SHA_FINAL ; + ret =tegra_cmac_init (req); +if (ret) +return ret; + rctx->task |=SHA_UPDATE |SHA_FINAL ;return crypto_transfer_hash_request_to_engine (ctx->se->engine, req); }
drivers/crypto/tegra/tegra-se-hash.c +5 -2
@@ -615,13 +615,16 @@ static int tegra_sha_digest(struct ahash_request *req)struct tegra_sha_reqctx *rctx =ahash_request_ctx (req);struct crypto_ahash *tfm =crypto_ahash_reqtfm (req);struct tegra_sha_ctx *ctx =crypto_ahash_ctx (tfm); +int ret;if (ctx->fallback)return tegra_sha_fallback_digest (req); -tegra_sha_init (req); - rctx->task |=SHA_UPDATE |SHA_FINAL ; + ret =tegra_sha_init (req); +if (ret) +return ret; + rctx->task |=SHA_UPDATE |SHA_FINAL ;return crypto_transfer_hash_request_to_engine (ctx->se->engine, req); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 263/623 crypto: api - Fix boot-up self-test race
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Herbert Xu <[email protected]>
[ Upstream commit 8dd458cbc5be9ce4427ffce7a9dcdbff4dfc4ac9 ]
During the boot process self-tests are postponed so that all algorithms are registered when the test starts. In the event that algorithms are still being registered during these tests, which can occur either because the algorithm is registered at late_initcall, or because a self-test itself triggers the creation of an instance, some self-tests may never start at all.
Fix this by setting the flag at the start of crypto_start_tests.
Note that this race is theoretical and has never been observed in practice.
--- crypto/algapi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/algapi.c +2 -2
@@ -1016,6 +1016,8 @@ static void __init crypto_start_tests(void)if (IS_ENABLED (CONFIG_CRYPTO_MANAGER_DISABLE_TESTS ))return ; +set_crypto_boot_test_finished (); +for (;;) {struct crypto_larval *larval =NULL ;struct crypto_alg *q;
@@ -1047,8 +1049,6 @@ static void __init crypto_start_tests(void)if (!larval)break ; } - -set_crypto_boot_test_finished (); }static int __init crypto_algapi_init (void )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 264/623 crypto: caam - use JobRs space to access page 0 regs
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gaurav Jain <[email protected]>
[ Upstream commit 73a7496c218b7ca19ba276f54758e7f0adf269c5 ]
On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller region(CAAM page 0) is not permitted from non secure world. use JobR's register space to access page 0 registers.
--- drivers/crypto/caam/blob_gen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/caam/blob_gen.c +2 -1
@@ -2,6 +2,7 @@/* * Copyright (C) 2015 Pengutronix, Steffen Trumtrar <[email protected]> * Copyright (C) 2021 Pengutronix, Ahmad Fatoum <[email protected]> +* Copyright 2024 NXP */ #define pr_fmt (fmt) "caam blob_gen: " fmt
@@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv, } ctrlpriv =dev_get_drvdata (jrdev->parent); - moo =FIELD_GET (CSTA_MOO ,rd_reg32 (&ctrlpriv->ctrl->perfmon.status)); + moo =FIELD_GET (CSTA_MOO ,rd_reg32 (&ctrlpriv->jr[0 ]->perfmon.status));if (moo !=CSTA_MOO_SECURE && moo !=CSTA_MOO_TRUSTED )dev_warn (jrdev,"using insecure test key, enable HAB to use unique device key!\n" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 265/623 platform/x86: x86-android-tablets: Add missing __init to get_i2c_adap_by_*()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 981fd70a5ac4347368fa8a3329b7d67f1c567ee7 ]
get_i2c_adap_by_handle() and get_i2c_adap_by_pci_parent() both are only used by x86_instantiate_i2c_client() which is __init itself and in case of the latter it also uses match_parent() which is also __init.
--- drivers/platform/x86/x86-android-tablets/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/x86-android-tablets/core.c +2 -2
@@ -157,7 +157,7 @@ static struct gpiod_lookup_table * const *gpiod_lookup_tables;static const struct software_node *bat_swnode;static void (*exit_handler)(void ); -static struct i2c_adapter * +static __init struct i2c_adapter *get_i2c_adap_by_handle (const struct x86_i2c_client_info *client_info) {acpi_handle handle;
@@ -177,7 +177,7 @@ static __init int match_parent(struct device *dev, const void *data)return dev->parent == data; } -static struct i2c_adapter * +static __init struct i2c_adapter *get_i2c_adap_by_pci_parent (const struct x86_i2c_client_info *client_info) {struct i2c_adapter *adap =NULL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 266/623 platform/x86: x86-android-tablets: Make variables only used locally static
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit f6728073baa172be6223512fffd72796de891536 ]
Commit 06f876def346 ("platform/x86: x86-android-tablets: Add support for Vexia EDU ATLA 10 tablet") omitted the static keyword from some variables which are only used inside other.c .
Add the missing static keyword to these, this fixes the following warnings:
.../x86-android-tablets/other.c:605:12: sparse: sparse: symbol 'crystal_cove_pwrsrc_psy' was not declared. Should it be static? .../x86-android-tablets/other.c:612:28: sparse: sparse: symbol 'vexia_edu_atla10_ulpmc_node' was not declared. Should it be static?
--- drivers/platform/x86/x86-android-tablets/other.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/x86/x86-android-tablets/other.c +2 -2
@@ -602,14 +602,14 @@ const struct x86_dev_info whitelabel_tm800a550l_info __initconst = {* Vexia EDU ATLA 10 tablet, Android 4.2 / 4.4 + Guadalinex Ubuntu tablet * distributed to schools in the Spanish Andalucía region. */ -const char *const crystal_cove_pwrsrc_psy[] = {"crystal_cove_pwrsrc" }; +static const char *const crystal_cove_pwrsrc_psy[] = {"crystal_cove_pwrsrc" };static const struct property_entry vexia_edu_atla10_ulpmc_props[] = {PROPERTY_ENTRY_STRING_ARRAY ("supplied-from" , crystal_cove_pwrsrc_psy), { } }; -const struct software_node vexia_edu_atla10_ulpmc_node = { +static const struct software_node vexia_edu_atla10_ulpmc_node = { .properties = vexia_edu_atla10_ulpmc_props, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 267/623 perf header: Fix one memory leakage in process_bpf_btf()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit 875d22980a062521beed7b5df71fb13a1af15d83 ]
If __perf_env__insert_btf() returns false due to a duplicate btf node insertion, the temporary node will leak. Add a check to ensure the memory is freed if the function returns false.
--- tools/perf/util/header.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/header.c +2 -1
@@ -3205,7 +3205,8 @@ static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused)if (__do_read (ff, node->data, data_size)) goto out; -__perf_env__insert_btf (env, node); +if (!__perf_env__insert_btf (env, node)) +free (node); node =NULL ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 268/623 perf header: Fix one memory leakage in process_bpf_prog_info()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit a7da6c7030e1aec32f0a41c7b4fa70ec96042019 ]
Function __perf_env__insert_bpf_prog_info() will return without inserting bpf prog info node into perf env again due to a duplicate bpf prog info node insertion, causing the temporary info_linear and info_node memory to leak. Modify the return type of this function to bool and add a check to ensure the memory is freed if the function returns false.
--- tools/perf/util/env.c | 5 +++-- tools/perf/util/env.h | 2 +- tools/perf/util/header.c | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-)
tools/perf/util/env.c +3 -2
@@ -32,7 +32,7 @@ void perf_env__insert_bpf_prog_info(struct perf_env *env,up_write (&env->bpf_progs.lock); } -void __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node) +bool __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node) {__u32 prog_id = info_node->info_linear->info.id;struct bpf_prog_info_node *node;
@@ -50,13 +50,14 @@ void __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info p = &(*p)->rb_right; }else {pr_debug ("duplicated bpf prog info %u\n" , prog_id); -return ; +return false; } }rb_link_node (&info_node->rb_node, parent, p);rb_insert_color (&info_node->rb_node, &env->bpf_progs.infos); env->bpf_progs.infos_cnt++; +return true; } struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env,
tools/perf/util/env.h +1 -1
@@ -176,7 +176,7 @@ const char *perf_env__raw_arch(struct perf_env *env);int perf_env__nr_cpus_avail (struct perf_env *env);void perf_env__init (struct perf_env *env); -void __perf_env__insert_bpf_prog_info (struct perf_env *env, +bool __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node);void perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node);
tools/perf/util/header.c +4 -1
@@ -3158,7 +3158,10 @@ static int process_bpf_prog_info(struct feat_fd *ff, void *data __maybe_unused)/* after reading from file, translate offset to address */ bpil_offs_to_addr (info_linear); info_node->info_linear = info_linear; -__perf_env__insert_bpf_prog_info (env, info_node); +if (!__perf_env__insert_bpf_prog_info (env, info_node)) { +free (info_linear); +free (info_node); + } }up_write (&env->bpf_progs.lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 269/623 perf bpf: Fix two memory leakages when calling perf_env__insert_bpf_prog_info()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhongqiu Han <[email protected]>
[ Upstream commit 03edb7020bb920f1935c3f30acad0bb27fdb99af ]
If perf_env__insert_bpf_prog_info() returns false due to a duplicate bpf prog info node insertion, the temporary info_node and info_linear memory will leak. Add a check to ensure the memory is freed if the function returns false.
--- tools/perf/util/bpf-event.c | 10 ++++++++-- tools/perf/util/env.c | 8 ++++++-- tools/perf/util/env.h | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-)
tools/perf/util/bpf-event.c +8 -2
@@ -289,7 +289,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, } info_node->info_linear = info_linear; -perf_env__insert_bpf_prog_info (env, info_node); +if (!perf_env__insert_bpf_prog_info (env, info_node)) { +free (info_linear); +free (info_node); + } info_linear =NULL ;/*
@@ -480,7 +483,10 @@ static void perf_env__add_bpf_info(struct perf_env *env, u32 id) info_node =malloc (sizeof (struct bpf_prog_info_node ));if (info_node) { info_node->info_linear = info_linear; -perf_env__insert_bpf_prog_info (env, info_node); +if (!perf_env__insert_bpf_prog_info (env, info_node)) { +free (info_linear); +free (info_node); + } }else free (info_linear);
tools/perf/util/env.c +6 -2
@@ -24,12 +24,16 @@ struct perf_env perf_env;#include "bpf-utils.h" #include <bpf/libbpf.h> -void perf_env__insert_bpf_prog_info (struct perf_env *env, +bool perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node) { +bool ret; +down_write (&env->bpf_progs.lock); -__perf_env__insert_bpf_prog_info (env, info_node); + ret =__perf_env__insert_bpf_prog_info (env, info_node);up_write (&env->bpf_progs.lock); + +return ret; }bool __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node)
tools/perf/util/env.h +1 -1
@@ -178,7 +178,7 @@ int perf_env__nr_cpus_avail(struct perf_env *env);void perf_env__init (struct perf_env *env);bool __perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node); -void perf_env__insert_bpf_prog_info (struct perf_env *env, +bool perf_env__insert_bpf_prog_info (struct perf_env *env,struct bpf_prog_info_node *info_node);struct bpf_prog_info_node *perf_env__find_bpf_prog_info (struct perf_env *env,__u32 prog_id);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 270/623 ASoC: renesas: rz-ssi: Use only the proper amount of dividers
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 55c209cd4318c701e6e88e0b2512a0f12dd02a7d ]
There is no need to populate the ckdv[] with invalid dividers as that part will not be indexed anyway. The ssi->audio_mck/bclk_rate should always be >= 0. While at it, change the ckdv type as u8, as the divider 128 was previously using the s8 sign bit.
--- sound/soc/renesas/rz-ssi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/renesas/rz-ssi.c +1 -2
@@ -258,8 +258,7 @@ static void rz_ssi_stream_quit(struct rz_ssi_priv *ssi,static int rz_ssi_clk_setup (struct rz_ssi_priv *ssi,unsigned int rate,unsigned int channels) { -static s8 ckdv[16 ] = {1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 , -6 ,12 ,24 ,48 ,96 ,-1 ,-1 ,-1 }; +static u8 ckdv[] = {1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 ,6 ,12 ,24 ,48 ,96 };unsigned int channel_bits =32 ;/* System Word Length */ unsigned long bclk_rate = rate * channels * channel_bits;unsigned int div;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 271/623 tools build: Remove the libunwind feature tests from the ones detected when test-all.o builds
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <[email protected]>
[ Upstream commit b40fbeb0b1cd72912c41fb18c8b5e4b73ed191c4 ]
We have a tools/build/feature/test-all.c that has the most common set of features that perf uses and are expected to have its development files available when building perf.
When we made libwunwind opt-in we forgot to remove them from the list of features that are assumed to be available when test-all.c builds, remove them.
Before this patch:
$ rm -rf /tmp/b ; mkdir /tmp/b ; make -C tools/perf O=/tmp/b feature-dump ; grep feature-libunwind-aarch64= /tmp/b/FEATURE-DUMP feature-libunwind-aarch64=1 $
Even tho this not being test built and those header files being available:
$ head -5 tools/build/feature/test-libunwind-aarch64.c // SPDX-License-Identifier: GPL-2.0 #include <libunwind-aarch64.h> #include <stdlib.h>
extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as, $
After this patch:
$ grep feature-libunwind- /tmp/b/FEATURE-DUMP $
Now an audit on what is being enabled when test-all.c builds will be performed.
--- tools/build/Makefile.feature | 7 ------- 1 file changed, 7 deletions(-)
tools/build/Makefile.feature +0 -7
@@ -89,13 +89,6 @@ FEATURE_TESTS_EXTRA := \ libbfd-liberty \ libbfd-liberty-z \ libopencsd \ - libunwind-x86 \ - libunwind-x86_64 \ - libunwind-arm \ - libunwind-aarch64 \ - libunwind-debug-frame \ - libunwind-debug-frame-arm \ - libunwind-debug-frame-aarch64 \ cxx \ llvm \ clang \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 272/623 perf expr: Initialize is_test value in expr__ctx_new()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Levi Yun <[email protected]>
[ Upstream commit 1d18ebcfd302a2005b83ae5f13df223894d19902 ]
When expr_parse_ctx is allocated by expr_ctx_new(), expr_scanner_ctx->is_test isn't initialize, so it has garbage value. this can affects the result of expr__parse() return when it parses non-exist event literal according to garbage value.
Use calloc instead of malloc in expr_ctx_new() to fix this.
--- tools/perf/util/expr.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
tools/perf/util/expr.c +1 -4
@@ -285,7 +285,7 @@ struct expr_parse_ctx *expr__ctx_new(void) {struct expr_parse_ctx *ctx; - ctx =malloc (sizeof (struct expr_parse_ctx )); + ctx =calloc (1 ,sizeof (struct expr_parse_ctx ));if (!ctx)return NULL ;
@@ -294,9 +294,6 @@ struct expr_parse_ctx *expr__ctx_new(void)free (ctx);return NULL ; } - ctx->sctx.user_requested_cpu_list =NULL ; - ctx->sctx.runtime =0 ; - ctx->sctx.system_wide = false;return ctx; }
Signature · 1 line
2.39.5