6.16.1-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 126/627 riscv: dts: sophgo: sg2044: Add missing riscv,cbop-block-size property
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Inochi Amaoto <[email protected]>
[ Upstream commit 02d548e553d161813b7d3702a311b9067806057d ]
The kernel complains no "riscv,cbop-block-size" and disables the Zicbop extension. Add the missing property to keep it functional.
--- arch/riscv/boot/dts/sophgo/sg2044-cpus.dtsi | 64 +++++++++++++++++++++ 1 file changed, 64 insertions(+)
arch/riscv/boot/dts/sophgo/sg2044-cpus.dtsi +64 -0
@@ -38,6 +38,7 @@ cpu0: cpu@0 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu0_intc: interrupt-controller {
@@ -73,6 +74,7 @@ cpu1: cpu@1 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu1_intc: interrupt-controller {
@@ -108,6 +110,7 @@ cpu2: cpu@2 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu2_intc: interrupt-controller {
@@ -143,6 +146,7 @@ cpu3: cpu@3 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu3_intc: interrupt-controller {
@@ -178,6 +182,7 @@ cpu4: cpu@4 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu4_intc: interrupt-controller {
@@ -213,6 +218,7 @@ cpu5: cpu@5 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu5_intc: interrupt-controller {
@@ -248,6 +254,7 @@ cpu6: cpu@6 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu6_intc: interrupt-controller {
@@ -283,6 +290,7 @@ cpu7: cpu@7 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu7_intc: interrupt-controller {
@@ -318,6 +326,7 @@ cpu8: cpu@8 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu8_intc: interrupt-controller {
@@ -353,6 +362,7 @@ cpu9: cpu@9 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu9_intc: interrupt-controller {
@@ -388,6 +398,7 @@ cpu10: cpu@10 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu10_intc: interrupt-controller {
@@ -423,6 +434,7 @@ cpu11: cpu@11 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu11_intc: interrupt-controller {
@@ -458,6 +470,7 @@ cpu12: cpu@12 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu12_intc: interrupt-controller {
@@ -493,6 +506,7 @@ cpu13: cpu@13 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu13_intc: interrupt-controller {
@@ -528,6 +542,7 @@ cpu14: cpu@14 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu14_intc: interrupt-controller {
@@ -563,6 +578,7 @@ cpu15: cpu@15 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu15_intc: interrupt-controller {
@@ -598,6 +614,7 @@ cpu16: cpu@16 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu16_intc: interrupt-controller {
@@ -633,6 +650,7 @@ cpu17: cpu@17 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu17_intc: interrupt-controller {
@@ -668,6 +686,7 @@ cpu18: cpu@18 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu18_intc: interrupt-controller {
@@ -703,6 +722,7 @@ cpu19: cpu@19 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu19_intc: interrupt-controller {
@@ -738,6 +758,7 @@ cpu20: cpu@20 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu20_intc: interrupt-controller {
@@ -773,6 +794,7 @@ cpu21: cpu@21 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu21_intc: interrupt-controller {
@@ -808,6 +830,7 @@ cpu22: cpu@22 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu22_intc: interrupt-controller {
@@ -843,6 +866,7 @@ cpu23: cpu@23 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu23_intc: interrupt-controller {
@@ -878,6 +902,7 @@ cpu24: cpu@24 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu24_intc: interrupt-controller {
@@ -913,6 +938,7 @@ cpu25: cpu@25 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu25_intc: interrupt-controller {
@@ -948,6 +974,7 @@ cpu26: cpu@26 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu26_intc: interrupt-controller {
@@ -983,6 +1010,7 @@ cpu27: cpu@27 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu27_intc: interrupt-controller {
@@ -1018,6 +1046,7 @@ cpu28: cpu@28 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu28_intc: interrupt-controller {
@@ -1053,6 +1082,7 @@ cpu29: cpu@29 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu29_intc: interrupt-controller {
@@ -1088,6 +1118,7 @@ cpu30: cpu@30 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu30_intc: interrupt-controller {
@@ -1123,6 +1154,7 @@ cpu31: cpu@31 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu31_intc: interrupt-controller {
@@ -1158,6 +1190,7 @@ cpu32: cpu@32 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu32_intc: interrupt-controller {
@@ -1193,6 +1226,7 @@ cpu33: cpu@33 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu33_intc: interrupt-controller {
@@ -1228,6 +1262,7 @@ cpu34: cpu@34 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu34_intc: interrupt-controller {
@@ -1263,6 +1298,7 @@ cpu35: cpu@35 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu35_intc: interrupt-controller {
@@ -1298,6 +1334,7 @@ cpu36: cpu@36 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu36_intc: interrupt-controller {
@@ -1333,6 +1370,7 @@ cpu37: cpu@37 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu37_intc: interrupt-controller {
@@ -1368,6 +1406,7 @@ cpu38: cpu@38 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu38_intc: interrupt-controller {
@@ -1403,6 +1442,7 @@ cpu39: cpu@39 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu39_intc: interrupt-controller {
@@ -1438,6 +1478,7 @@ cpu40: cpu@40 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu40_intc: interrupt-controller {
@@ -1473,6 +1514,7 @@ cpu41: cpu@41 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu41_intc: interrupt-controller {
@@ -1508,6 +1550,7 @@ cpu42: cpu@42 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu42_intc: interrupt-controller {
@@ -1543,6 +1586,7 @@ cpu43: cpu@43 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu43_intc: interrupt-controller {
@@ -1578,6 +1622,7 @@ cpu44: cpu@44 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu44_intc: interrupt-controller {
@@ -1613,6 +1658,7 @@ cpu45: cpu@45 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu45_intc: interrupt-controller {
@@ -1648,6 +1694,7 @@ cpu46: cpu@46 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu46_intc: interrupt-controller {
@@ -1683,6 +1730,7 @@ cpu47: cpu@47 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu47_intc: interrupt-controller {
@@ -1718,6 +1766,7 @@ cpu48: cpu@48 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu48_intc: interrupt-controller {
@@ -1753,6 +1802,7 @@ cpu49: cpu@49 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu49_intc: interrupt-controller {
@@ -1788,6 +1838,7 @@ cpu50: cpu@50 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu50_intc: interrupt-controller {
@@ -1823,6 +1874,7 @@ cpu51: cpu@51 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu51_intc: interrupt-controller {
@@ -1858,6 +1910,7 @@ cpu52: cpu@52 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu52_intc: interrupt-controller {
@@ -1893,6 +1946,7 @@ cpu53: cpu@53 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu53_intc: interrupt-controller {
@@ -1928,6 +1982,7 @@ cpu54: cpu@54 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu54_intc: interrupt-controller {
@@ -1963,6 +2018,7 @@ cpu55: cpu@55 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu55_intc: interrupt-controller {
@@ -1998,6 +2054,7 @@ cpu56: cpu@56 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu56_intc: interrupt-controller {
@@ -2033,6 +2090,7 @@ cpu57: cpu@57 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu57_intc: interrupt-controller {
@@ -2068,6 +2126,7 @@ cpu58: cpu@58 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu58_intc: interrupt-controller {
@@ -2103,6 +2162,7 @@ cpu59: cpu@59 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu59_intc: interrupt-controller {
@@ -2138,6 +2198,7 @@ cpu60: cpu@60 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu60_intc: interrupt-controller {
@@ -2173,6 +2234,7 @@ cpu61: cpu@61 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu61_intc: interrupt-controller {
@@ -2208,6 +2270,7 @@ cpu62: cpu@62 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu62_intc: interrupt-controller {
@@ -2243,6 +2306,7 @@ cpu63: cpu@63 { "zvfbfmin", "zvfbfwma", "zvfh", "zvfhmin"; riscv,cbom-block-size = <64>; + riscv,cbop-block-size = <64>; riscv,cboz-block-size = <64>; cpu63_intc: interrupt-controller {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 127/627 staging: nvec: Fix incorrect null termination of battery manufacturer
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alok Tiwari <[email protected]>
[ Upstream commit a8934352ba01081c51d2df428e9d540aae0e88b5 ]
The battery manufacturer string was incorrectly null terminated using bat_model instead of bat_manu. This could result in an unintended write to the wrong field and potentially incorrect behavior.
fixe the issue by correctly null terminating the bat_manu string.
--- drivers/staging/nvec/nvec_power.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/nvec/nvec_power.c +1 -1
@@ -194,7 +194,7 @@ static int nvec_power_bat_notifier(struct notifier_block *nb,break ;case MANUFACTURER :memcpy (power->bat_manu, &res->plc, res->length -2 ); - power->bat_model[res->length -2 ] ='\0' ; + power->bat_manu[res->length -2 ] ='\0' ;break ;case MODEL :memcpy (power->bat_model, &res->plc, res->length -2 );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 128/627 selftests/tracing: Fix false failure of subsystem event test
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 213879061a9c60200ba971330dbefec6df3b4a30 ]
The subsystem event test enables all "sched" events and makes sure there's at least 3 different events in the output. It used to cat the entire trace file to | wc -l, but on slow machines, that could last a very long time. To solve that, it was changed to just read the first 100 lines of the trace file. This can cause false failures as some events repeat so often, that the 100 lines that are examined could possibly be of only one event.
Instead, create an awk script that looks for 3 different events and will exit out after it finds them. This will find the 3 events the test looks for (eventually if it works), and still exit out after the test is satisfied and not cause slower machines to run forever.
--- .../ftrace/test.d/event/subsystem-enable.tc | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc +26 -2
@@ -14,11 +14,35 @@ fail() { #msg exit_fail } +# As reading trace can last forever, simply look for 3 different +# events then exit out of reading the file. If there's not 3 different +# events, then the test has failed. +check_unique() { + cat trace | grep -v '^#' | awk ' + BEGIN { cnt = 0; } + { + for (i = 0; i < cnt; i++) { + if (event[i] == $5) { + break; + } + } + if (i == cnt) { + event[cnt++] = $5; + if (cnt > 2) { + exit; + } + } + } + END { + printf "%d", cnt; + }' +} + echo 'sched:*' > set_event yield -count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` +count=`check_unique` if [ $count -lt 3 ]; then fail "at least fork, exec and exit events should be recorded" fi
@@ -29,7 +53,7 @@ echo 1 > events/sched/enable yield -count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` +count=`check_unique` if [ $count -lt 3 ]; then fail "at least fork, exec and exit events should be recorded" fi
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 129/627 MIPS: alchemy: gpio: use new GPIO line value setter callbacks for the remaining chips
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit 6b94bf976f9f9e6d4a6bf3218968a506c049702e ]
Previous commit missed two other places that need converting, it only came out in tests on autobuilders now. Convert the rest of the driver.
--- arch/mips/alchemy/common/gpiolib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
arch/mips/alchemy/common/gpiolib.c +8 -4
@@ -40,9 +40,11 @@ static int gpio2_get(struct gpio_chip *chip, unsigned offset)return !!alchemy_gpio2_get_value (offset +ALCHEMY_GPIO2_BASE ); } -static void gpio2_set (struct gpio_chip *chip,unsigned offset,int value) +static int gpio2_set (struct gpio_chip *chip,unsigned offset,int value) {alchemy_gpio2_set_value (offset +ALCHEMY_GPIO2_BASE , value); + +return 0 ; }static int gpio2_direction_input (struct gpio_chip *chip,unsigned offset)
@@ -68,10 +70,12 @@ static int gpio1_get(struct gpio_chip *chip, unsigned offset)return !!alchemy_gpio1_get_value (offset +ALCHEMY_GPIO1_BASE ); } -static void gpio1_set (struct gpio_chip *chip, +static int gpio1_set (struct gpio_chip *chip,unsigned offset,int value) {alchemy_gpio1_set_value (offset +ALCHEMY_GPIO1_BASE , value); + +return 0 ; }static int gpio1_direction_input (struct gpio_chip *chip,unsigned offset)
@@ -97,7 +101,7 @@ struct gpio_chip alchemy_gpio_chip[] = { .direction_input = gpio1_direction_input, .direction_output = gpio1_direction_output, .get = gpio1_get, - .set = gpio1_set, + .set_rv = gpio1_set, .to_irq = gpio1_to_irq, .base = ALCHEMY_GPIO1_BASE, .ngpio = ALCHEMY_GPIO1_NUM,
@@ -107,7 +111,7 @@ struct gpio_chip alchemy_gpio_chip[] = { .direction_input = gpio2_direction_input, .direction_output = gpio2_direction_output, .get = gpio2_get, - .set = gpio2_set, + .set_rv = gpio2_set, .to_irq = gpio2_to_irq, .base = ALCHEMY_GPIO2_BASE, .ngpio = ALCHEMY_GPIO2_NUM,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 130/627 Revert "udmabuf: fix vmap_udmabuf error page set"
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huan Yang <[email protected]>
[ Upstream commit ceb7b62eaaaacfcf87473bd2e99ac73a758620cb ]
This reverts commit 18d7de823b7150344d242c3677e65d68c5271b04.
We cannot use vmap_pfn() in vmap_udmabuf() as it would fail the pfn_valid() check in vmap_pfn_apply(). This is because vmap_pfn() is intended to be used for mapping non-struct-page memory such as PCIe BARs. Since, udmabuf mostly works with pages/folios backed by shmem/hugetlbfs/THP, vmap_pfn() is not the right tool or API to invoke for implementing vmap.
Stable-dep-of: a26fd92b7223 ("udmabuf: fix vmap missed offset page")
--- drivers/dma-buf/Kconfig | 1 - drivers/dma-buf/udmabuf.c | 22 +++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-)
drivers/dma-buf/Kconfig +0 -1
@@ -36,7 +36,6 @@ config UDMABUF depends on DMA_SHARED_BUFFER depends on MEMFD_CREATE || COMPILE_TEST depends on MMU - select VMAP_PFN help A driver to let userspace turn memfd regions into dma-bufs. Qemu can use this to create host dmabufs for guest framebuffers.
drivers/dma-buf/udmabuf.c +7 -15
@@ -109,29 +109,21 @@ static int mmap_udmabuf(struct dma_buf *buf, struct vm_area_struct *vma)static int vmap_udmabuf (struct dma_buf *buf,struct iosys_map *map) {struct udmabuf *ubuf = buf->priv; -unsigned long *pfns; +struct page **pages;void *vaddr;pgoff_t pg;dma_resv_assert_held (buf->resv); -/** -* HVO may free tail pages, so just use pfn to map each folio -* into vmalloc area. -*/ - pfns =kvmalloc_array (ubuf->pagecount,sizeof (*pfns),GFP_KERNEL ); -if (!pfns) + pages =kvmalloc_array (ubuf->pagecount,sizeof (*pages),GFP_KERNEL ); +if (!pages)return -ENOMEM ; -for (pg =0 ; pg < ubuf->pagecount; pg++) { -unsigned long pfn =folio_pfn (ubuf->folios[pg]); - - pfn += ubuf->offsets[pg] >>PAGE_SHIFT ; - pfns[pg] = pfn; - } +for (pg =0 ; pg < ubuf->pagecount; pg++) + pages[pg] = &ubuf->folios[pg]->page; - vaddr =vmap_pfn (pfns, ubuf->pagecount,PAGE_KERNEL ); -kvfree (pfns); + vaddr =vm_map_ram (pages, ubuf->pagecount,-1 ); +kvfree (pages);if (!vaddr)return -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 131/627 udmabuf: fix vmap missed offset page
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huan Yang <[email protected]>
[ Upstream commit a26fd92b7223160ad31c3e2971b63178faed9cf5 ]
Before invoke vmap, we need offer a pages pointer array which each page need to map in vmalloc area.
But currently vmap_udmabuf only set each folio's head page into pages, missed each offset pages when iter.
This patch set the correctly offset page in each folio into array.
--- drivers/dma-buf/udmabuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma-buf/udmabuf.c +2 -1
@@ -120,7 +120,8 @@ static int vmap_udmabuf(struct dma_buf *buf, struct iosys_map *map)return -ENOMEM ;for (pg =0 ; pg < ubuf->pagecount; pg++) - pages[pg] = &ubuf->folios[pg]->page; + pages[pg] =folio_page (ubuf->folios[pg], + ubuf->offsets[pg] >>PAGE_SHIFT ); vaddr =vm_map_ram (pages, ubuf->pagecount,-1 );kvfree (pages);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 132/627 drm/rockchip: cleanup fb when drm_gem_fb_afbc_init failed
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Yan <[email protected]>
[ Upstream commit 099593a28138b48feea5be8ce700e5bc4565e31d ]
In the function drm_gem_fb_init_with_funcs, the framebuffer (fb) and its corresponding object ID have already been registered.
So we need to cleanup the drm framebuffer if the subsequent execution of drm_gem_fb_afbc_init fails.
Directly call drm_framebuffer_put to ensure that all fb related resources are cleanup.
--- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_fb.c +1 -8
@@ -52,16 +52,9 @@ rockchip_fb_create(struct drm_device *dev, struct drm_file *file, }if (drm_is_afbc (mode_cmd->modifier[0 ])) { -int ret, i; - ret =drm_gem_fb_afbc_init (dev, mode_cmd, afbc_fb);if (ret) { -struct drm_gem_object **obj = afbc_fb->base.obj; - -for (i =0 ; i < info->num_planes; ++i) -drm_gem_object_put (obj[i]); - -kfree (afbc_fb); +drm_framebuffer_put (&afbc_fb->base);return ERR_PTR (ret); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 133/627 drm/sitronix: Remove broken backwards-compatibility layer
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit a3f7d26dfce9e2d547a58f4941881843a391a6cc ]
When moving the Sitronix DRM drivers and renaming their Kconfig symbols, the old symbols were kept, aiming to provide a seamless migration path when running "make olddefconfig" or "make oldconfig".
However, the old compatibility symbols are not visible. Hence unless they are selected by another symbol (which they are not), they can never be enabled, and no backwards compatibility is provided.
Drop the broken mechanism and the old symbols.
--- drivers/gpu/drm/sitronix/Kconfig | 10 ---------- 1 file changed, 10 deletions(-)
drivers/gpu/drm/sitronix/Kconfig +0 -10
@@ -11,10 +11,6 @@ config DRM_ST7571_I2C if M is selected the module will be called st7571-i2c. -config TINYDRM_ST7586 - tristate - default n - config DRM_ST7586 tristate "DRM support for Sitronix ST7586 display panels" depends on DRM && SPI
@@ -22,17 +18,12 @@ config DRM_ST7586 select DRM_KMS_HELPER select DRM_GEM_DMA_HELPER select DRM_MIPI_DBI - default TINYDRM_ST7586 help DRM driver for the following Sitronix ST7586 panels: * LEGO MINDSTORMS EV3 If M is selected the module will be called st7586. -config TINYDRM_ST7735R - tristate - default n - config DRM_ST7735R tristate "DRM support for Sitronix ST7715R/ST7735R display panels" depends on DRM && SPI
@@ -41,7 +32,6 @@ config DRM_ST7735R select DRM_GEM_DMA_HELPER select DRM_MIPI_DBI select BACKLIGHT_CLASS_DEVICE - default TINYDRM_ST7735R help DRM driver for Sitronix ST7715R/ST7735R with one of the following LCDs:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 134/627 drm/connector: hdmi: Evaluate limited range after computing format
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Ciocaltea <[email protected]>
[ Upstream commit 21f627139652dd8329a88e281df6600f3866d238 ]
Evaluating the requirement to use a limited RGB quantization range involves a verification of the output format, among others, but this is currently performed before actually computing the format, hence relying on the old connector state.
Move the call to hdmi_is_limited_range() after hdmi_compute_config() to ensure the verification is done on the updated output format.
--- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/display/drm_hdmi_state_helper.c +2 -2
@@ -798,12 +798,12 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_connector *connector,if (!new_conn_state->crtc || !new_conn_state->best_encoder)return 0 ; - new_conn_state->hdmi.is_limited_range =hdmi_is_limited_range (connector, new_conn_state); - ret =hdmi_compute_config (connector, new_conn_state, mode);if (ret)return ret; + new_conn_state->hdmi.is_limited_range =hdmi_is_limited_range (connector, new_conn_state); + ret =hdmi_generate_infoframes (connector, new_conn_state);if (ret)return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 135/627 drm/panfrost: Fix panfrost device variable name in devfreq
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrián Larumbe <[email protected]>
[ Upstream commit 6048f5587614bb4919c54966913452c1a0a43138 ]
Commit 64111a0e22a9 ("drm/panfrost: Fix incorrect updating of current device frequency") was a Panfrost port of a similar fix in Panthor.
Fix the Panfrost device pointer variable name so that it follows Panfrost naming conventions.
--- drivers/gpu/drm/panfrost/panfrost_devfreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/panfrost/panfrost_devfreq.c +2 -2
@@ -29,7 +29,7 @@ static void panfrost_devfreq_update_utilization(struct panfrost_devfreq *pfdevfrstatic int panfrost_devfreq_target (struct device *dev,unsigned long *freq,u32 flags) { -struct panfrost_device *ptdev =dev_get_drvdata (dev); +struct panfrost_device *pfdev =dev_get_drvdata (dev);struct dev_pm_opp *opp;int err;
@@ -40,7 +40,7 @@ static int panfrost_devfreq_target(struct device *dev, unsigned long *freq, err =dev_pm_opp_set_rate (dev, *freq);if (!err) - ptdev->pfdevfreq.current_frequency = *freq; + pfdev->pfdevfreq.current_frequency = *freq;return err; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 136/627 drm/panthor: Add missing explicit padding in drm_panthor_gpu_info
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Boris Brezillon <[email protected]>
[ Upstream commit 95cbab48782bf62e4093837dc15ac6133902c12f ]
drm_panthor_gpu_info::shader_present is currently automatically offset by 4 byte to meet Arm's 32-bit/64-bit field alignment rules, but those constraints don't stand on 32-bit x86 and cause a mismatch when running an x86 binary in a user emulated environment like FEX. It's also generally agreed that uAPIs should explicitly pad their struct fields, which we originally intended to do, but a mistake slipped through during the submission process, leading drm_panthor_gpu_info::shader_present to be misaligned.
This uAPI change doesn't break any of the existing users of panthor which are either arm32 or arm64 where the 64-bit alignment of u64 fields is already enforced a the compiler level.
Changes in v2:
- Rename the garbage field into pad0 and adjust the comment accordingly
- Add Liviu's A-b
Changes in v3:
- Add R-bs
--- include/uapi/drm/panthor_drm.h | 3 +++ 1 file changed, 3 insertions(+)
include/uapi/drm/panthor_drm.h +3 -0
@@ -296,6 +296,9 @@ struct drm_panthor_gpu_info {/** @as_present: Bitmask encoding the number of address-space exposed by the MMU. */ __u32 as_present; +/** @pad0: MBZ. */ +__u32 pad0; +/** @shader_present: Bitmask encoding the shader cores exposed by the GPU. */ __u64 shader_present;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 137/627 wifi: rtw89: mcc: prevent shift wrapping in rtw89_core_mlsr_switch()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 53cf488927a0f79968f9c03c4d1e00d2a79731c3 ]
The "link_id" value comes from the user via debugfs. If it's larger than BITS_PER_LONG then that would result in shift wrapping and potentially an out of bounds access later. In fact, we can limit it to IEEE80211_MLD_MAX_NUM_LINKS (15).
Fortunately, only root can write to debugfs files so the security impact is minimal.
--- drivers/net/wireless/realtek/rtw89/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/core.c +2 -1
@@ -5239,7 +5239,8 @@ int rtw89_core_mlsr_switch(struct rtw89_dev *rtwdev, struct rtw89_vif *rtwvif,if (unlikely (!ieee80211_vif_is_mld (vif)))return -EOPNOTSUPP ; -if (unlikely (!(usable_links &BIT (link_id)))) { +if (unlikely (link_id >=IEEE80211_MLD_MAX_NUM_LINKS || + !(usable_links &BIT (link_id)))) {rtw89_warn (rtwdev,"%s: link id %u is not usable\n" , __func__, link_id);return -ENOLINK ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 138/627 wifi: rtw89: sar: drop lockdep assertion in rtw89_set_sar_from_acpi
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 6fe21445f7e801de5527d420f8e25e97b0cdd7e2 ]
The following assertion is triggered on the rtw89 driver startup. It looks meaningless to hold wiphy lock on the early init stage so drop the assertion.
WARNING: CPU: 7 PID: 629 at drivers/net/wireless/realtek/rtw89/sar.c:502 rtw89_set_sar_from_acpi+0x365/0x4d0 [rtw89_core] CPU: 7 UID: 0 PID: 629 Comm: (udev-worker) Not tainted 6.15.0+ #29 PREEMPT(lazy) Hardware name: LENOVO 21D0/LNVNB161216, BIOS J6CN50WW 09/27/2024 RIP: 0010:rtw89_set_sar_from_acpi+0x365/0x4d0 [rtw89_core] Call Trace: <TASK> rtw89_sar_init+0x68/0x2c0 [rtw89_core] rtw89_core_init+0x188e/0x1e50 [rtw89_core] rtw89_pci_probe+0x530/0xb50 [rtw89_pci] local_pci_probe+0xd9/0x190 pci_call_probe+0x183/0x540 pci_device_probe+0x171/0x2c0 really_probe+0x1e1/0x890 __driver_probe_device+0x18c/0x390 driver_probe_device+0x4a/0x120 __driver_attach+0x1a0/0x530 bus_for_each_dev+0x10b/0x190 bus_add_driver+0x2eb/0x540 driver_register+0x1a3/0x3a0 do_one_initcall+0xd5/0x450 do_init_module+0x2cc/0x8f0 init_module_from_file+0xe1/0x150 idempotent_init_module+0x226/0x760 __x64_sys_finit_module+0xcd/0x150 do_syscall_64+0x94/0x380 entry_SYSCALL_64_after_hwframe+0x76/0x7e
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/sar.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/realtek/rtw89/sar.c +0 -2
@@ -499,8 +499,6 @@ static void rtw89_set_sar_from_acpi(struct rtw89_dev *rtwdev)struct rtw89_sar_cfg_acpi *cfg;int ret; -lockdep_assert_wiphy (rtwdev->hw->wiphy); - cfg =kzalloc (sizeof (*cfg),GFP_KERNEL );if (!cfg)return ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 139/627 wifi: rtw89: sar: do not assert wiphy lock held until probing is done
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit dad7aafa5216e307b357b801668451a3b8945810 ]
rtw89_sar_set_src() may be called at driver early init phase when applying SAR configuration via ACPI. wiphy lock is not held there.
Since the assertion was initially added for rtw89_apply_sar_common() call path and may be helpful for other places in future changes, keep it but move it under RTW89_FLAG_PROBE_DONE test.
Found by Linux Verification Center (linuxtesting.org).
--- drivers/net/wireless/realtek/rtw89/sar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/sar.c +2 -1
@@ -199,7 +199,8 @@ struct rtw89_sar_handler rtw89_sar_handlers[RTW89_SAR_SOURCE_NR] = {typeof (_dev) _d = (_dev); \BUILD_BUG_ON (!rtw89_sar_handlers[_s].descr_sar_source); \BUILD_BUG_ON (!rtw89_sar_handlers[_s].query_sar_config); \ -lockdep_assert_wiphy (_d->hw->wiphy); \ +if (test_bit (RTW89_FLAG_PROBE_DONE , _d->flags)) \ +lockdep_assert_wiphy (_d->hw->wiphy); \ _d->sar._cfg_name = *(_cfg_data); \ _d->sar.src = _s; \ }while (0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 140/627 wifi: rtw89: fix EHT 20MHz TX rate for non-AP STA
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Chung Chen <[email protected]>
[ Upstream commit fe30a8ae853bade282fce63e740b5f34bdc55f6e ]
The 4-octet EHT MCS/NSS subfield is only used for 20 MHz-only non-AP STA. Correct the interpretation of this subfield to prevent improper rate limitations.
--- drivers/net/wireless/realtek/rtw89/phy.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/realtek/rtw89/phy.c +7 -5
@@ -119,10 +119,12 @@ static u64 get_eht_mcs_ra_mask(u8 *max_nss, u8 start_mcs, u8 n_nss)return mask; } -static u64 get_eht_ra_mask (struct ieee80211_link_sta *link_sta) +static u64 get_eht_ra_mask (struct rtw89_vif_link *rtwvif_link, +struct ieee80211_link_sta *link_sta) { -struct ieee80211_sta_eht_cap *eht_cap = &link_sta->eht_cap; +struct ieee80211_vif *vif =rtwvif_link_to_vif (rtwvif_link);struct ieee80211_eht_mcs_nss_supp_20mhz_only *mcs_nss_20mhz; +struct ieee80211_sta_eht_cap *eht_cap = &link_sta->eht_cap;struct ieee80211_eht_mcs_nss_supp_bw *mcs_nss;u8 *he_phy_cap = link_sta->he_cap.he_cap_elem.phy_cap_info;
@@ -136,8 +138,8 @@ static u64 get_eht_ra_mask(struct ieee80211_link_sta *link_sta)/* MCS 9, 11, 13 */ return get_eht_mcs_ra_mask (mcs_nss->rx_tx_max_nss,9 ,3 );case IEEE80211_STA_RX_BW_20 : -if (!(he_phy_cap[0 ] & -IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL )) { +if (vif->type ==NL80211_IFTYPE_AP && + !(he_phy_cap[0 ] &IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL )) { mcs_nss_20mhz = &eht_cap->eht_mcs_nss_supp.only_20mhz;/* MCS 7, 9, 11, 13 */ return get_eht_mcs_ra_mask (mcs_nss_20mhz->rx_tx_max_nss,7 ,4 );
@@ -332,7 +334,7 @@ static void rtw89_phy_ra_sta_update(struct rtw89_dev *rtwdev,/* Set the ra mask from sta's capability */ if (link_sta->eht_cap.has_eht) { mode |=RTW89_RA_MODE_EHT ; - ra_mask |=get_eht_ra_mask (link_sta); + ra_mask |=get_eht_ra_mask (rtwvif_link, link_sta);if (rtwdev->hal.no_mcs_12_13) high_rate_masks = rtw89_ra_mask_eht_mcs0_11;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 141/627 bpf, sockmap: Fix psock incorrectly pointing to sk
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 76be5fae32febb1fdb848ba09f78c4b2c76cb337 ]
We observed an issue from the latest selftest: sockmap_redir where sk_psock(psock->sk) != psock in the backlog. The root cause is the special behavior in sockmap_redir - it frequently performs map_update() and map_delete() on the same socket. During map_update(), we create a new psock and during map_delete(), we eventually free the psock via rcu_work in sk_psock_drop(). However, pending workqueues might still exist and not be processed yet. If users immediately perform another map_update(), a new psock will be allocated for the same sk, resulting in two psocks pointing to the same sk.
When the pending workqueue is later triggered, it uses the old psock to access sk for I/O operations, which is incorrect.
Timing Diagram:
cpu0 cpu1
map_update(sk):
sk->psock = psock1
psock1->sk = skmap_delete(sk):
rcu_work_free(psock1)
map_update(sk):
sk->psock = psock2
psock2->sk = sk
workqueue:
wakeup with psock1, but the sk of psock1 doesn't belong to psock1rcu_handler:
clean psock1
free(psock1)
Previously, we used reference counting to address the concurrency issue between backlog and sock_map_close(). This logic remains necessary as it prevents the sk from being freed while processing the backlog. But this patch prevents pending backlogs from using a psock after it has been stopped.
Note: We cannot call cancel_delayed_work_sync() in map_delete() since this might be invoked in BPF context by BPF helper, and the function may sleep.
--- net/core/skmsg.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/core/skmsg.c +7 -0
@@ -656,6 +656,13 @@ static void sk_psock_backlog(struct work_struct *work)bool ingress;int ret; +/* If sk is quickly removed from the map and then added back, the old +* psock should not be scheduled, because there are now two psocks +* pointing to the same sk. +*/ +if (!sk_psock_test_state (psock,SK_PSOCK_TX_ENABLED )) +return ; +/* Increment the psock refcnt to synchronize with close(fd) path in * sock_map_close(), ensuring we wait for backlog thread completion * before sk_socket freed. If refcnt increment fails, it indicates
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 142/627 netconsole: Only register console drivers when targets are configured
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit bc0cb64db1c765a81f69997d5a28f539e1731bc0 ]
The netconsole driver currently registers the basic console driver unconditionally during initialization, even when only extended targets are configured. This results in unnecessary console registration and performance overhead, as the write_msg() callback is invoked for every log message only to return early when no matching targets are found.
Optimize the driver by conditionally registering console drivers based on the actual target configuration. The basic console driver is now registered only when non-extended targets exist, same as the extended console. The implementation also handles dynamic target creation through the configfs interface.
This change eliminates unnecessary console driver registrations, redundant write_msg() callbacks for unused console types, and associated lock contention and target list iterations. The optimization is particularly beneficial for systems using only the most common extended console type.
--- drivers/net/netconsole.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
drivers/net/netconsole.c +22 -8
@@ -86,10 +86,10 @@ static DEFINE_SPINLOCK(target_list_lock);static DEFINE_MUTEX (target_cleanup_list_lock);/* -* Console driver for extended netconsoles. Registered on the first use to -* avoid unnecessarily enabling ext message formatting. +* Console driver for netconsoles. Register only consoles that have +* an associated target of the same type. */ -static struct console netconsole_ext; +static struct console netconsole_ext, netconsole;struct netconsole_target_stats {u64_stats_t xmit_drop_count;
@@ -97,6 +97,11 @@ struct netconsole_target_stats {struct u64_stats_sync syncp; }; +enum console_type { +CONS_BASIC =BIT (0 ), +CONS_EXTENDED =BIT (1 ), +}; +/* Features enabled in sysdata. Contrary to userdata, this data is populated by * the kernel. The fields are designed as bitwise flags, allowing multiple * features to be set in sysdata_fields.
@@ -491,6 +496,12 @@ static ssize_t enabled_store(struct config_item *item,if (nt->extended && !console_is_registered (&netconsole_ext))register_console (&netconsole_ext); +/* User might be enabling the basic format target for the very +* first time, make sure the console is registered. +*/ +if (!nt->extended && !console_is_registered (&netconsole)) +register_console (&netconsole); +/* * Skip netpoll_parse_options() -- all the attributes are * already configured via configfs. Just print them out.
@@ -1690,8 +1701,8 @@ static int __init init_netconsole(void) {int err;struct netconsole_target *nt, *tmp; +u32 console_type_needed =0 ;unsigned int count =0 ; -bool extended = false;unsigned long flags;char *target_config;char *input = config;
@@ -1707,9 +1718,10 @@ static int __init init_netconsole(void) }/* Dump existing printks when we register */ if (nt->extended) { - extended = true; + console_type_needed |=CONS_EXTENDED ; netconsole_ext.flags |=CON_PRINTBUFFER ; }else { + console_type_needed |=CONS_BASIC ; netconsole.flags |=CON_PRINTBUFFER ; }
@@ -1728,9 +1740,10 @@ static int __init init_netconsole(void)if (err) goto undonotifier; -if (extended) +if (console_type_needed &CONS_EXTENDED )register_console (&netconsole_ext); -register_console (&netconsole); +if (console_type_needed &CONS_BASIC ) +register_console (&netconsole);pr_info ("network logging started\n" );return err;
@@ -1760,7 +1773,8 @@ static void __exit cleanup_netconsole(void)if (console_is_registered (&netconsole_ext))unregister_console (&netconsole_ext); -unregister_console (&netconsole); +if (console_is_registered (&netconsole)) +unregister_console (&netconsole);dynamic_netconsole_exit ();unregister_netdevice_notifier (&netconsole_netdev_notifier);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 143/627 bpf, ktls: Fix data corruption when using bpf_msg_pop_data() in ktls
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiayuan Chen <[email protected]>
[ Upstream commit 178f6a5c8cb3b6be1602de0964cd440243f493c9 ]
When sending plaintext data, we initially calculated the corresponding ciphertext length. However, if we later reduced the plaintext data length via socket policy, we failed to recalculate the ciphertext length.
This results in transmitting buffers containing uninitialized data during ciphertext transmission.
This causes uninitialized bytes to be appended after a complete "Application Data" packet, leading to errors on the receiving end when parsing TLS record.
--- net/tls/tls_sw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/tls/tls_sw.c +13 -0
@@ -872,6 +872,19 @@ static int bpf_exec_tx_verdict(struct sk_msg *msg, struct sock *sk, delta = msg->sg.size; psock->eval =sk_psock_msg_verdict (sk, psock, msg); delta -= msg->sg.size; + +if ((s32 )delta >0 ) { +/* It indicates that we executed bpf_msg_pop_data(), +* causing the plaintext data size to decrease. +* Therefore the encrypted data size also needs to +* correspondingly decrease. We only need to subtract +* delta to calculate the new ciphertext length since +* ktls does not support block encryption. +*/ +struct sk_msg *enc = &ctx->open_rec->msg_encrypted; + +sk_msg_trim (sk, enc, enc->sg.size - delta); + } }if (msg->cork_bytes && msg->cork_bytes > msg->sg.size && !enospc && !full_record) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 144/627 net, bpf: Fix RCU usage in task_cls_state() for BPF programs
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charalampos Mitrodimas <[email protected]>
[ Upstream commit 7f12c33850482521c961c5c15a50ebe9b9a88d1e ]
The commit ee971630f20f ("bpf: Allow some trace helpers for all prog types") made bpf_get_cgroup_classid_curr helper available to all BPF program types, not just networking programs.
This helper calls __task_get_classid() which internally calls task_cls_state() requiring rcu_read_lock_bh_held(). This works in networking/tc context where RCU BH is held, but triggers an RCU warning when called from other contexts like BPF syscall programs that run under rcu_read_lock_trace():
WARNING: suspicious RCU usage 6.15.0-rc4-syzkaller-g079e5c56a5c4 #0 Not tainted
-----------------------------
net/core/netclassid_cgroup.c:24 suspicious rcu_dereference_check() usage!
Fix this by also accepting rcu_read_lock_held() and rcu_read_lock_trace_held() as valid RCU contexts in the task_cls_state() function. This ensures the helper works correctly in all needed RCU contexts where it might be called, regular RCU, RCU BH (for networking), and RCU trace (for BPF syscall programs).
--- net/core/netclassid_cgroup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/netclassid_cgroup.c +3 -1
@@ -21,7 +21,9 @@ static inline struct cgroup_cls_state *css_cls_state(struct cgroup_subsys_statestruct cgroup_cls_state *task_cls_state (struct task_struct *p) {return css_cls_state (task_css_check (p, net_cls_cgrp_id, -rcu_read_lock_bh_held ())); +rcu_read_lock_held () || +rcu_read_lock_bh_held () || +rcu_read_lock_trace_held ())); }EXPORT_SYMBOL_GPL (task_cls_state);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 145/627 selftests/bpf: fix signedness bug in redir_partial()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fushuai Wang <[email protected]>
[ Upstream commit 6a4bd31f680a1d1cf06492fe6dc4f08da09769e6 ]
When xsend() returns -1 (error), the check 'n < sizeof(buf)' incorrectly treats it as success due to unsigned promotion. Explicitly check for -1 first.
--- tools/testing/selftests/bpf/prog_tests/sockmap_listen.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/prog_tests/sockmap_listen.c +2 -0
@@ -924,6 +924,8 @@ static void redir_partial(int family, int sotype, int sock_map, int parser_map) goto close; n =xsend (c1, buf,sizeof (buf),0 ); +if (n ==-1 ) + goto close;if (n <sizeof (buf))FAIL ("incomplete write" );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 146/627 bpf: handle jset (if a & b ...) as a jump in CFG computation
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduard Zingerman <[email protected]>
[ Upstream commit 3157f7e2999616ac91f4d559a8566214f74000a5 ]
BPF_JSET is a conditional jump and currently verifier.c:can_jump() does not know about that. This can lead to incorrect live registers and SCC computation.
E.g. in the following example:
1: r0 = 1; 2: r2 = 2; 3: if r1 & 0x7 goto +1; 4: exit; 5: r0 = r2; 6: exit;
W/o this fix insn_successors(3) will return only (4), a jump to (5) would be missed and r2 won't be marked as alive at (3).
--- kernel/bpf/verifier.c | 1 + 1 file changed, 1 insertion(+)
kernel/bpf/verifier.c +1 -0
@@ -23671,6 +23671,7 @@ static bool can_jump(struct bpf_insn *insn)case BPF_JSLT :case BPF_JSLE :case BPF_JCOND : +case BPF_JSET :return true; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 147/627 selftests/bpf: Fix unintentional switch case fall through
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mykyta Yatsenko <[email protected]>
[ Upstream commit 66ab68c9de89672366fdc474f4f185bb58cecf2d ]
Break from switch expression after parsing -n CLI argument in veristat, instead of falling through and enabling comparison mode.
--- tools/testing/selftests/bpf/veristat.c | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/bpf/veristat.c +1 -0
@@ -344,6 +344,7 @@ static error_t parse_arg(int key, char *arg, struct argp_state *state)fprintf (stderr,"invalid top N specifier: %s\n" , arg);argp_usage (state); } +break ;case 'C' : env.comparison_mode = true;break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 148/627 net: ipv6: ip6mr: Fix in/out netdev to pass to the FORWARD chain
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Petr Machata <[email protected]>
[ Upstream commit 3365afd3abda5f6a54f4a822dad5c9314e94c3fc ]
The netfilter hook is invoked with skb->dev for input netdevice, and vif_dev for output netdevice. However at the point of invocation, skb->dev is already set to vif_dev, and MR-forwarded packets are reported with in=out:
# ip6tables -A FORWARD -j LOG --log-prefix '[forw]' # cd tools/testing/selftests/net/forwarding # ./router_multicast.sh # dmesg | fgrep '[forw]' [ 1670.248245] [forw]IN=v5 OUT=v5 [...]
For reference, IPv4 MR code shows in and out as appropriate. Fix by caching skb->dev and using the updated value for output netdev.
--- net/ipv6/ip6mr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/ip6mr.c +2 -1
@@ -2039,6 +2039,7 @@ static int ip6mr_forward2(struct net *net, struct mr_table *mrt, struct sk_buff *skb, int vifi) {struct vif_device *vif = &mrt->vif_table[vifi]; +struct net_device *indev = skb->dev;struct net_device *vif_dev;struct ipv6hdr *ipv6h;struct dst_entry *dst;
@@ -2101,7 +2102,7 @@ static int ip6mr_forward2(struct net *net, struct mr_table *mrt,IP6CB (skb)->flags |=IP6SKB_FORWARDED ;return NF_HOOK (NFPROTO_IPV6 ,NF_INET_FORWARD , - net,NULL , skb, skb->dev, vif_dev, + net,NULL , skb, indev, skb->dev, ip6mr_forward2_finish); out_free:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 149/627 drm/vmwgfx: Fix Host-Backed userspace on Guest-Backed kernel
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Forbes <[email protected]>
[ Upstream commit 7872997c048e989c7689c2995d230fdca7798000 ]
Running 3D applications with SVGA_FORCE_HOST_BACKED=1 or using an ancient version of mesa was broken because the buffer was pinned in VMW_BO_DOMAIN_SYS and could not be moved to VMW_BO_DOMAIN_MOB during validation.
The compat_shader buffer should not pinned.
--- drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_shader.c +1 -1
@@ -896,7 +896,7 @@ int vmw_compat_shader_add(struct vmw_private *dev_priv, .busy_domain = VMW_BO_DOMAIN_SYS, .bo_type = ttm_bo_type_device, .size = size, - .pin = true, + .pin = false, .keep_resv = true, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 150/627 slub: Fix a documentation build error for krealloc()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Corbet <[email protected]>
[ Upstream commit e8a45f198e3ae2434108f815bc28f37f6fe6742b ]
The kerneldoc comment for krealloc() contains an unmarked literal block, leading to these warnings in the docs build:
./mm/slub.c:4936: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils] ./mm/slub.c:4936: ERROR: Undefined substitution referenced: "--------". [docutils]
Mark up and indent the block properly to bring a bit of peace to our build logs.
--- mm/slub.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
mm/slub.c +5 -5
@@ -4930,12 +4930,12 @@ __do_krealloc(const void *p, size_t new_size, gfp_t flags)* When slub_debug_orig_size() is off, krealloc() only knows about the bucket * size of an allocation (but not the exact size it was allocated with) and * hence implements the following semantics for shrinking and growing buffers -* with __GFP_ZERO. +* with __GFP_ZERO:: * -* new bucket -* 0 size size -* |--------|----------------| -* | keep | zero | +* new bucket +* 0 size size +* |--------|----------------| +* | keep | zero | * * Otherwise, the original allocation size 'orig_size' could be used to * precisely clear the requested size, and the new size will also be stored
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 151/627 drm/amdgpu: Remove nbiov7.9 replay count reporting
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
[ Upstream commit 0f566f0e9c614aa3d95082246f5b8c9e8a09c8b3 ]
Direct pcie replay count reporting is not available on nbio v7.9. Reporting is done through firmware.
--- drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c | 20 -------------------- 1 file changed, 20 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +0 -20
@@ -31,9 +31,6 @@#define NPS_MODE_MASK 0x000000FFL -/* Core 0 Port 0 counter */ -#define smnPCIEP_NAK_COUNTER 0x1A340218 -static void nbio_v7_9_remap_hdp_registers (struct amdgpu_device *adev) { WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL,
@@ -467,22 +464,6 @@ static void nbio_v7_9_init_registers(struct amdgpu_device *adev) } } -static u64 nbio_v7_9_get_pcie_replay_count (struct amdgpu_device *adev) -{ -u32 val, nak_r, nak_g; - -if (adev->flags &AMD_IS_APU ) -return 0 ; - -/* Get the number of NAKs received and generated */ - val =RREG32_PCIE (smnPCIEP_NAK_COUNTER); - nak_r = val &0xFFFF ; - nak_g = val >>16 ; - -/* Add the total number of NAKs, i.e the number of replays */ -return (nak_r + nak_g); -} -#define MMIO_REG_HOLE_OFFSET 0x1A000static void nbio_v7_9_set_reg_remap (struct amdgpu_device *adev)
@@ -524,7 +505,6 @@ const struct amdgpu_nbio_funcs nbio_v7_9_funcs = { .get_memory_partition_mode = nbio_v7_9_get_memory_partition_mode, .is_nps_switch_requested = nbio_v7_9_is_nps_switch_requested, .init_registers = nbio_v7_9_init_registers, - .get_pcie_replay_count = nbio_v7_9_get_pcie_replay_count, .set_reg_remap = nbio_v7_9_set_reg_remap, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 152/627 drm/amdgpu/sdma: handle paging queues in amdgpu_sdma_reset_engine()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 9a9e87d15297ce72507178e93cbb773510c061cd ]
Need to properly start and stop paging queues if they are present.
This is not an issue today since we don't support a paging queue on any chips with queue reset.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +8 -2
@@ -597,8 +597,11 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id) page_sched_stopped = true; } -if (sdma_instance->funcs->stop_kernel_queue) +if (sdma_instance->funcs->stop_kernel_queue) { sdma_instance->funcs->stop_kernel_queue (gfx_ring); +if (adev->sdma.has_page_queue) + sdma_instance->funcs->stop_kernel_queue (page_ring); + }/* Perform the SDMA reset for the specified instance */ ret =amdgpu_sdma_soft_reset (adev, instance_id);
@@ -607,8 +610,11 @@ int amdgpu_sdma_reset_engine(struct amdgpu_device *adev, uint32_t instance_id) goto exit; } -if (sdma_instance->funcs->start_kernel_queue) +if (sdma_instance->funcs->start_kernel_queue) { sdma_instance->funcs->start_kernel_queue (gfx_ring); +if (adev->sdma.has_page_queue) + sdma_instance->funcs->start_kernel_queue (page_ring); + } exit:/* Restart the scheduler's work queue for the GFX and page rings
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 153/627 net: mana: Fix potential deadlocks in mana napi ops
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erni Sri Satya Vennela <[email protected]>
[ Upstream commit d5c8f0e4e0cb0ac2a4a4e015f2f5b1ba39e5e583 ]
When net_shaper_ops are enabled for MANA, netdev_ops_lock becomes active.
MANA VF setup/teardown by netvsc follows this call chain:
netvsc_vf_setup()
dev_change_flags()
...
__dev_open() OR __dev_close()dev_change_flags() holds the netdev mutex via netdev_lock_ops.
Meanwhile, mana_create_txq() and mana_create_rxq() in mana_open() path call NAPI APIs (netif_napi_add_tx(), netif_napi_add_weight(), napi_enable()), which also try to acquire the same lock, risking deadlock.
Similarly in the teardown path (mana_close()), netif_napi_disable() and netif_napi_del(), contend for the same lock.
Switch to the _locked variants of these APIs to avoid deadlocks when the netdev_ops_lock is held.
--- drivers/net/ethernet/microsoft/mana/mana_en.c | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/net/ethernet/microsoft/mana/mana_en.c +19 -9
@@ -1912,8 +1912,10 @@ static void mana_destroy_txq(struct mana_port_context *apc) napi = &apc->tx_qp[i].tx_cq.napi;if (apc->tx_qp[i].txq.napi_initialized) {napi_synchronize (napi); -napi_disable (napi); -netif_napi_del (napi); +netdev_lock_ops_to_full (napi->dev); +napi_disable_locked (napi); +netif_napi_del_locked (napi); +netdev_unlock_full_to_ops (napi->dev); apc->tx_qp[i].txq.napi_initialized = false; }mana_destroy_wq_obj (apc,GDMA_SQ , apc->tx_qp[i].tx_object);
@@ -2065,8 +2067,11 @@ static int mana_create_txq(struct mana_port_context *apc,mana_create_txq_debugfs (apc, i); -netif_napi_add_tx (net, &cq->napi, mana_poll); -napi_enable (&cq->napi); +set_bit (NAPI_STATE_NO_BUSY_POLL , &cq->napi.state); +netdev_lock_ops_to_full (net); +netif_napi_add_locked (net, &cq->napi, mana_poll); +napi_enable_locked (&cq->napi); +netdev_unlock_full_to_ops (net); txq->napi_initialized = true;mana_gd_ring_cq (cq->gdma_cq,SET_ARM_BIT );
@@ -2102,9 +2107,10 @@ static void mana_destroy_rxq(struct mana_port_context *apc,if (napi_initialized) {napi_synchronize (napi); -napi_disable (napi); - -netif_napi_del (napi); +netdev_lock_ops_to_full (napi->dev); +napi_disable_locked (napi); +netif_napi_del_locked (napi); +netdev_unlock_full_to_ops (napi->dev); }xdp_rxq_info_unreg (&rxq->xdp_rxq);
@@ -2355,14 +2361,18 @@ static struct mana_rxq *mana_create_rxq(struct mana_port_context *apc, gc->cq_table[cq->gdma_id] = cq->gdma_cq; -netif_napi_add_weight (ndev, &cq->napi, mana_poll,1 ); +netdev_lock_ops_to_full (ndev); +netif_napi_add_weight_locked (ndev, &cq->napi, mana_poll,1 ); +netdev_unlock_full_to_ops (ndev);WARN_ON (xdp_rxq_info_reg (&rxq->xdp_rxq, ndev, rxq_idx, cq->napi.napi_id));WARN_ON (xdp_rxq_info_reg_mem_model (&rxq->xdp_rxq,MEM_TYPE_PAGE_POOL , rxq->page_pool)); -napi_enable (&cq->napi); +netdev_lock_ops_to_full (ndev); +napi_enable_locked (&cq->napi); +netdev_unlock_full_to_ops (ndev);mana_gd_ring_cq (cq->gdma_cq,SET_ARM_BIT ); out:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 154/627 wifi: mac80211: Fix bssid_indicator for MBSSID in AP mode
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rameshkumar Sundaram <[email protected]>
[ Upstream commit 2eb7c1baf46aea134e908cd6d37907d92f823251 ]
Currently, in ieee80211_assign_beacon() mbssid count is updated as link's bssid_indicator. mbssid count is the total number of MBSSID elements in the beacon instead of Max BSSID indicator of the Multiple BSS set. This will result in drivers obtaining an invalid bssid_indicator for BSSes in a Multiple BSS set.
Fix this by updating link's bssid_indicator from MBSSID element for Transmitting BSS and update the same for all of its Non-Transmitting BSSes.
--- net/mac80211/cfg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/mac80211/cfg.c +6 -2
@@ -178,6 +178,7 @@ static int ieee80211_set_ap_mbssid_options(struct ieee80211_sub_if_data *sdata, link_conf->nontransmitted = true; link_conf->bssid_index = params->index; + link_conf->bssid_indicator = tx_bss_conf->bssid_indicator; }if (params->ema) link_conf->ema_ap = true;
@@ -1218,8 +1219,11 @@ ieee80211_assign_beacon(struct ieee80211_sub_if_data *sdata,ieee80211_copy_rnr_beacon (pos, new->rnr_ies, rnr); }/* update bssid_indicator */ - link_conf->bssid_indicator = -ilog2 (__roundup_pow_of_two (mbssid->cnt +1 )); +if (new->mbssid_ies->cnt && new->mbssid_ies->elem[0 ].len >2 ) + link_conf->bssid_indicator = + *(new->mbssid_ies->elem[0 ].data +2 ); +else + link_conf->bssid_indicator =0 ; }if (csa) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 155/627 bpftool: Fix memory leak in dump_xx_nlmsg on realloc failure
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuan Chen <[email protected]>
[ Upstream commit 99fe8af069a9fa5b09140518b1364e35713a642e ]
In function dump_xx_nlmsg(), when realloc() fails to allocate memory, the original pointer to the buffer is overwritten with NULL. This causes a memory leak because the previously allocated buffer becomes unreachable without being freed.
--- tools/bpf/bpftool/net.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/bpf/bpftool/net.c +9 -6
@@ -366,17 +366,18 @@ static int dump_link_nlmsg(void *cookie, void *msg, struct nlattr **tb) {struct bpf_netdev_t *netinfo = cookie;struct ifinfomsg *ifinfo = msg; +struct ip_devname_ifindex *tmp;if (netinfo->filter_idx >0 && netinfo->filter_idx != ifinfo->ifi_index)return 0 ;if (netinfo->used_len == netinfo->array_len) { - netinfo->devices =realloc (netinfo->devices, - (netinfo->array_len +16 ) * -sizeof (struct ip_devname_ifindex )); -if (!netinfo->devices) + tmp =realloc (netinfo->devices, + (netinfo->array_len +16 ) *sizeof (struct ip_devname_ifindex )); +if (!tmp)return -ENOMEM ; + netinfo->devices = tmp; netinfo->array_len +=16 ; } netinfo->devices[netinfo->used_len].ifindex = ifinfo->ifi_index;
@@ -395,6 +396,7 @@ static int dump_class_qdisc_nlmsg(void *cookie, void *msg, struct nlattr **tb) {struct bpf_tcinfo_t *tcinfo = cookie;struct tcmsg *info = msg; +struct tc_kind_handle *tmp;if (tcinfo->is_qdisc) {/* skip clsact qdisc */
@@ -406,11 +408,12 @@ static int dump_class_qdisc_nlmsg(void *cookie, void *msg, struct nlattr **tb) }if (tcinfo->used_len == tcinfo->array_len) { - tcinfo->handle_array =realloc (tcinfo->handle_array, + tmp =realloc (tcinfo->handle_array, (tcinfo->array_len +16 ) *sizeof (struct tc_kind_handle )); -if (!tcinfo->handle_array) +if (!tmp)return -ENOMEM ; + tcinfo->handle_array = tmp; tcinfo->array_len +=16 ; } tcinfo->handle_array[tcinfo->used_len].handle = info->tcm_handle;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 156/627 powerpc/pseries/dlpar: Search DRC index from ibm,drc-indexes for IO add
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haren Myneni <[email protected]>
[ Upstream commit 41a1452759a8b1121df9cf7310acf31d766ba70b ]
IO hotplug add event is handled in the user space with drmgr tool. After the device is enabled, the user space uses /sys/kernel/dlpar interface with “dt add index <drc_index>” to update the device tree. The kernel interface (dlpar_hp_dt_add()) finds the parent node for the specified ‘drc_index’ from ibm,drc-info property. The recent FW provides this property from 2017 onwards. But KVM guest code in some releases is still using the older SLOF firmware which has ibm,drc-indexes property instead of ibm,drc-info.
If the ibm,drc-info is not available, this patch adds changes to search ‘drc_index’ from the indexes array in ibm,drc-indexes property to support old FW.
--- arch/powerpc/platforms/pseries/dlpar.c | 52 +++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/dlpar.c +50 -2
@@ -404,6 +404,45 @@ get_device_node_with_drc_info(u32 index)return NULL ; } +static struct device_node * +get_device_node_with_drc_indexes (u32 drc_index) +{ +struct device_node *np =NULL ; +u32 nr_indexes, index; +int i, rc; + +for_each_node_with_property (np,"ibm,drc-indexes" ) { +/* +* First element in the array is the total number of +* DRC indexes returned. +*/ + rc =of_property_read_u32_index (np,"ibm,drc-indexes" , +0 , &nr_indexes); +if (rc) + goto out_put_np; + +/* +* Retrieve DRC index from the list and return the +* device node if matched with the specified index. +*/ +for (i =0 ; i < nr_indexes; i++) { + rc =of_property_read_u32_index (np,"ibm,drc-indexes" , + i+1 , &index); +if (rc) + goto out_put_np; + +if (drc_index == index) +return np; + } + } + +return NULL ; + +out_put_np: +of_node_put (np); +return NULL ; +} +static int dlpar_hp_dt_add (u32 index) {struct device_node *np, *nodes;
@@ -423,10 +462,19 @@ static int dlpar_hp_dt_add(u32 index) goto out; } +/* +* Recent FW provides ibm,drc-info property. So search +* for the user specified DRC index from ibm,drc-info +* property. If this property is not available, search +* in the indexes array from ibm,drc-indexes property. +*/ np =get_device_node_with_drc_info (index); -if (!np) -return -EIO ; +if (!np) { + np =get_device_node_with_drc_indexes (index); +if (!np) +return -EIO ; + }/* Next, configure the connector. */ nodes =dlpar_configure_connector (cpu_to_be32 (index), np);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 157/627 wifi: ath12k: Avoid accessing uninitialized arvif->ar during beacon miss
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rameshkumar Sundaram <[email protected]>
[ Upstream commit 36670b67de18f1e5d34900c5d2ac60a8970c293c ]
During beacon miss handling, ath12k driver iterates over active virtual interfaces (vifs) and attempts to access the radio object (ar) via arvif->deflink->ar.
However, after commit aa80f12f3bed ("wifi: ath12k: defer vdev creation for MLO"), arvif is linked to a radio only after vdev creation, typically when a channel is assigned or a scan is requested.
For P2P capable devices, a default P2P interface is created by wpa_supplicant along with regular station interfaces, these serve as dummy interfaces for P2P-capable stations, lack an associated netdev and initiate frequent scans to discover neighbor p2p devices. When a scan is initiated on such P2P vifs, driver selects destination radio (ar) based on scan frequency, creates a scan vdev, and attaches arvif to the radio. Once the scan completes or is aborted, the scan vdev is deleted, detaching arvif from the radio and leaving arvif->ar uninitialized.
While handling beacon miss for station interfaces, P2P interface is also encountered in the vif iteration and ath12k_mac_handle_beacon_miss_iter() tries to dereference the uninitialized arvif->deflink->ar.
Fix this by verifying that vdev is created for the arvif before accessing its ar during beacon miss handling and similar vif iterator callbacks.
==========================================================================
wlp6s0: detected beacon loss from AP (missed 7 beacons) - probing
KASAN: null-ptr-deref in range [0x0000000000000010-0x0000000000000017] CPU: 5 UID: 0 PID: 0 Comm: swapper/5 Not tainted 6.16.0-rc1-wt-ath+ #2 PREEMPT(full) RIP: 0010:ath12k_mac_handle_beacon_miss_iter+0xb5/0x1a0 [ath12k] Call Trace: __iterate_interfaces+0x11a/0x410 [mac80211] ieee80211_iterate_active_interfaces_atomic+0x61/0x140 [mac80211] ath12k_mac_handle_beacon_miss+0xa1/0xf0 [ath12k] ath12k_roam_event+0x393/0x560 [ath12k] ath12k_wmi_op_rx+0x1486/0x28c0 [ath12k] ath12k_htc_process_trailer.isra.0+0x2fb/0x620 [ath12k] ath12k_htc_rx_completion_handler+0x448/0x830 [ath12k] ath12k_ce_recv_process_cb+0x549/0x9e0 [ath12k] ath12k_ce_per_engine_service+0xbe/0xf0 [ath12k] ath12k_pci_ce_workqueue+0x69/0x120 [ath12k] process_one_work+0xe3a/0x1430
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/mac.c | 15 +++++++++------ drivers/net/wireless/ath/ath12k/p2p.c | 3 ++- 2 files changed, 11 insertions(+), 7 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +9 -6
@@ -693,6 +693,9 @@ static void ath12k_get_arvif_iter(void *data, u8 *mac,if (WARN_ON (!arvif))continue ; +if (!arvif->is_created) +continue ; +if (arvif->vdev_id == arvif_iter->vdev_id && arvif->ar == arvif_iter->ar) { arvif_iter->arvif = arvif;
@@ -1755,7 +1758,7 @@ static void ath12k_mac_handle_beacon_iter(void *data, u8 *mac,struct ath12k_vif *ahvif =ath12k_vif_to_ahvif (vif);struct ath12k_link_vif *arvif = &ahvif->deflink; -if (vif->type !=NL80211_IFTYPE_STATION ) +if (vif->type !=NL80211_IFTYPE_STATION || !arvif->is_created)return ;if (!ether_addr_equal (mgmt->bssid, vif->bss_conf.bssid))
@@ -1778,16 +1781,16 @@ static void ath12k_mac_handle_beacon_miss_iter(void *data, u8 *mac,u32 *vdev_id = data;struct ath12k_vif *ahvif =ath12k_vif_to_ahvif (vif);struct ath12k_link_vif *arvif = &ahvif->deflink; -struct ath12k *ar = arvif->ar; -struct ieee80211_hw *hw =ath12k_ar_to_hw (ar); +struct ieee80211_hw *hw; -if (arvif->vdev_id != *vdev_id) +if (!arvif->is_created || arvif->vdev_id != *vdev_id)return ;if (!arvif->is_up)return ;ieee80211_beacon_loss (vif); + hw =ath12k_ar_to_hw (arvif->ar);/* Firmware doesn't report beacon loss events repeatedly. If AP probe * (done by mac80211) succeeds but beacons do not resume then it
@@ -9818,7 +9821,7 @@ ath12k_mac_change_chanctx_cnt_iter(void *data, u8 *mac,if (WARN_ON (!arvif))continue ; -if (arvif->ar != arg->ar) +if (!arvif->is_created || arvif->ar != arg->ar)continue ; link_conf = wiphy_dereference(ahvif->ah->hw->wiphy,
@@ -9853,7 +9856,7 @@ ath12k_mac_change_chanctx_fill_iter(void *data, u8 *mac,if (WARN_ON (!arvif))continue ; -if (arvif->ar != arg->ar) +if (!arvif->is_created || arvif->ar != arg->ar)continue ; link_conf = wiphy_dereference(ahvif->ah->hw->wiphy,
drivers/net/wireless/ath/ath12k/p2p.c +2 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. +* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. */ #include <net/mac80211.h>
@@ -124,7 +125,7 @@ static void ath12k_p2p_noa_update_vdev_iter(void *data, u8 *mac,WARN_ON (!rcu_read_lock_any_held ()); arvif = &ahvif->deflink; -if (arvif->ar != arg->ar || arvif->vdev_id != arg->vdev_id) +if (!arvif->is_created || arvif->ar != arg->ar || arvif->vdev_id != arg->vdev_id)return ;ath12k_p2p_noa_update (arvif, arg->noa);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 158/627 wifi: ath12k: update channel list in worker when wait flag is set
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kang Yang <[email protected]>
[ Upstream commit 437c7a2db6a34db2a9048920694a2bf9b0169726 ]
With previous patch [1], ath12k_reg_update_chan_list() will be called during reg_process_self_managed_hint().
reg_process_self_managed_hint() will hold rtnl_lock all the time. But ath12k_reg_update_chan_list() may increase the occupation time of rtnl_lock, because when wait flag is set, wait_for_completion_timeout() will be called during 11d/hw scan.
Should minimize the occupation time of rtnl_lock as much as possible to avoid interfering with rest of the system. So move the update channel list operation to a new worker, so that wait_for_completion_timeout() won't be called with the rtnl_lock held.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/core.c | 1 + drivers/net/wireless/ath/ath12k/core.h | 4 +- drivers/net/wireless/ath/ath12k/mac.c | 13 ++++ drivers/net/wireless/ath/ath12k/reg.c | 85 ++++++++++++++++++-------- drivers/net/wireless/ath/ath12k/reg.h | 1 + drivers/net/wireless/ath/ath12k/wmi.h | 1 + 6 files changed, 78 insertions(+), 27 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +1 -0
@@ -1409,6 +1409,7 @@ void ath12k_core_halt(struct ath12k *ar)ath12k_mac_peer_cleanup_all (ar);cancel_delayed_work_sync (&ar->scan.timeout);cancel_work_sync (&ar->regd_update_work); +cancel_work_sync (&ar->regd_channel_update_work);cancel_work_sync (&ab->rfkill_work);cancel_work_sync (&ab->update_11d_work);
drivers/net/wireless/ath/ath12k/core.h +3 -1
@@ -719,7 +719,7 @@ struct ath12k {/* protects the radio specific data like debug stats, ppdu_stats_info stats, * vdev_stop_status info, scan data, ath12k_sta info, ath12k_link_vif info, -* channel context data, survey info, test mode data. +* channel context data, survey info, test mode data, regd_channel_update_queue. */ spinlock_t data_lock;
@@ -778,6 +778,8 @@ struct ath12k {struct completion bss_survey_done;struct work_struct regd_update_work; +struct work_struct regd_channel_update_work; +struct list_head regd_channel_update_queue;struct wiphy_work wmi_mgmt_tx_work;struct sk_buff_head wmi_mgmt_tx_queue;
drivers/net/wireless/ath/ath12k/mac.c +13 -0
@@ -8289,6 +8289,7 @@ static void ath12k_mac_stop(struct ath12k *ar) {struct ath12k_hw *ah = ar->ah;struct htt_ppdu_stats_info *ppdu_stats, *tmp; +struct ath12k_wmi_scan_chan_list_arg *arg;int ret;lockdep_assert_held (&ah->hw_mutex);
@@ -8303,6 +8304,7 @@ static void ath12k_mac_stop(struct ath12k *ar)cancel_delayed_work_sync (&ar->scan.timeout);wiphy_work_cancel (ath12k_ar_to_hw (ar)->wiphy, &ar->scan.vdev_clean_wk); +cancel_work_sync (&ar->regd_channel_update_work);cancel_work_sync (&ar->regd_update_work);cancel_work_sync (&ar->ab->rfkill_work);cancel_work_sync (&ar->ab->update_11d_work);
@@ -8310,10 +8312,18 @@ static void ath12k_mac_stop(struct ath12k *ar)complete (&ar->completed_11d_scan);spin_lock_bh (&ar->data_lock); +list_for_each_entry_safe (ppdu_stats, tmp, &ar->ppdu_stats_info, list) {list_del (&ppdu_stats->list);kfree (ppdu_stats); } + +while ((arg =list_first_entry_or_null (&ar->regd_channel_update_queue, + struct ath12k_wmi_scan_chan_list_arg, + list))) { +list_del (&arg->list); +kfree (arg); + }spin_unlock_bh (&ar->data_lock);rcu_assign_pointer (ar->ab->pdevs_active[ar->pdev_idx],NULL );
@@ -12207,6 +12217,7 @@ static void ath12k_mac_hw_unregister(struct ath12k_hw *ah)int i;for_each_ar (ah, ar, i) { +cancel_work_sync (&ar->regd_channel_update_work);cancel_work_sync (&ar->regd_update_work);ath12k_debugfs_unregister (ar);ath12k_fw_stats_reset (ar);
@@ -12567,6 +12578,8 @@ static void ath12k_mac_setup(struct ath12k *ar)INIT_DELAYED_WORK (&ar->scan.timeout, ath12k_scan_timeout_work);wiphy_work_init (&ar->scan.vdev_clean_wk, ath12k_scan_vdev_clean_work); +INIT_WORK (&ar->regd_channel_update_work, ath12k_regd_update_chan_list_work); +INIT_LIST_HEAD (&ar->regd_channel_update_queue);INIT_WORK (&ar->regd_update_work, ath12k_regd_update_work);wiphy_work_init (&ar->wmi_mgmt_tx_work, ath12k_mgmt_over_wmi_tx_work);
drivers/net/wireless/ath/ath12k/reg.c +59 -26
103 lines not on this page · raw message
drivers/net/wireless/ath/ath12k/reg.h +1 -0
@@ -113,6 +113,7 @@ int ath12k_reg_handle_chan_list(struct ath12k_base *ab,struct ath12k_reg_info *reg_info, enum wmi_vdev_type vdev_type, enum ieee80211_ap_reg_power power_type); +void ath12k_regd_update_chan_list_work (struct work_struct *work);enum wmi_reg_6g_ap_type ath12k_reg_ap_pwr_convert (enum ieee80211_ap_reg_power power_type); enum ath12k_reg_status ath12k_reg_validate_reg_info(struct ath12k_base *ab,
drivers/net/wireless/ath/ath12k/wmi.h +1 -0
@@ -3948,6 +3948,7 @@ struct wmi_stop_scan_cmd { } __packed;struct ath12k_wmi_scan_chan_list_arg { +struct list_head list;u32 pdev_id;u16 nallchans;struct ath12k_wmi_channel_arg channel[];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 159/627 wifi: ath12k: Fix double budget decrement while reaping monitor ring
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: P Praneesh <[email protected]>
[ Upstream commit 54c350055b1da2767f18a49c11e4fcc42cf33ff8 ]
Currently, the budget for monitor ring is reduced during each ring entry reaping and again when the end reason is HAL_MON_END_OF_PPDU, leading to inefficient budget use. The below mentioned commit intended to decrement the budget only for HAL_MON_END_OF_PPDU but did not remove the other decrement. Fix this by eliminating the budget decrement for each ring entry reaping, ensuring the driver always reaps one full PPDU worth of entries from the monitor destination ring.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-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/dp_mon.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp_mon.c +0 -1
@@ -3761,7 +3761,6 @@ int ath12k_dp_mon_srng_process(struct ath12k *ar, int *budget,ath12k_hal_srng_access_begin (ab, srng);while (likely (*budget)) { - *budget -=1 ; mon_dst_desc =ath12k_hal_srng_dst_peek (ab, srng);if (unlikely (!mon_dst_desc))break ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 160/627 wifi: ath12k: Pass ab pointer directly to ath12k_dp_tx_get_encap_type()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamizh Chelvam Raja <[email protected]>
[ Upstream commit 05062834350f0bf7ad1abcebc2807220e90220eb ]
In ath12k_dp_tx_get_encap_type(), the arvif parameter is only used to retrieve the ab pointer. In vdev delete sequence the arvif->ar could become NULL and that would trigger kernel panic.
Since the caller ath12k_dp_tx() already has a valid ab pointer, pass it directly to avoid panic and unnecessary dereferencing.
PC points to "ath12k_dp_tx+0x228/0x988 [ath12k]"
LR points to "ath12k_dp_tx+0xc8/0x988 [ath12k]".
The Backtrace obtained is as follows:
ath12k_dp_tx+0x228/0x988 [ath12k] ath12k_mac_tx_check_max_limit+0x608/0x920 [ath12k] ieee80211_process_measurement_req+0x320/0x348 [mac80211] ieee80211_tx_dequeue+0x9ac/0x1518 [mac80211] ieee80211_tx_dequeue+0xb14/0x1518 [mac80211] ieee80211_tx_prepare_skb+0x224/0x254 [mac80211] ieee80211_xmit+0xec/0x100 [mac80211] __ieee80211_subif_start_xmit+0xc50/0xf40 [mac80211] ieee80211_subif_start_xmit+0x2e8/0x308 [mac80211] netdev_start_xmit+0x150/0x18c dev_hard_start_xmit+0x74/0xc0
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.3.1-00173-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp_tx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/dp_tx.c +2 -3
@@ -13,10 +13,9 @@#include "mac.h" static enum hal_tcl_encap_type -ath12k_dp_tx_get_encap_type (struct ath12k_link_vif *arvif,struct sk_buff *skb) +ath12k_dp_tx_get_encap_type (struct ath12k_base *ab,struct sk_buff *skb) {struct ieee80211_tx_info *tx_info =IEEE80211_SKB_CB (skb); -struct ath12k_base *ab = arvif->ar->ab;if (test_bit (ATH12K_FLAG_RAW_MODE , &ab->dev_flags))return HAL_TCL_ENCAP_TYPE_RAW ;
@@ -305,7 +304,7 @@ int ath12k_dp_tx(struct ath12k *ar, struct ath12k_link_vif *arvif,u32_encode_bits (mcbc_gsn,HTT_TCL_META_DATA_GLOBAL_SEQ_NUM ); } - ti.encap_type =ath12k_dp_tx_get_encap_type (arvif, skb); + ti.encap_type =ath12k_dp_tx_get_encap_type (ab, skb); ti.addr_search_flags = arvif->hal_addr_search_flags; ti.search_type = arvif->search_type; ti.type =HAL_TCL_DESC_TYPE_BUFFER ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 161/627 caif: reduce stack size, again
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit b630c781bcf6ff87657146661816d0d30a902139 ]
I tried to fix the stack usage in this function a couple of years ago, but there is still a problem with the latest gcc versions in some configurations:
net/caif/cfctrl.c:553:1: error: the frame size of 1296 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]
Reduce this once again, with a separate cfctrl_link_setup() function that holds the bulk of all the local variables. It also turns out that the param[] array that takes up a large portion of the stack is write-only and can be left out here.
--- net/caif/cfctrl.c | 294 +++++++++++++++++++++++----------------------- 1 file changed, 144 insertions(+), 150 deletions(-)
net/caif/cfctrl.c +144 -150
@@ -351,17 +351,154 @@ int cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer)return found; } +static int cfctrl_link_setup (struct cfctrl *cfctrl,struct cfpkt *pkt,u8 cmdrsp) +{ +u8 len; +u8 linkid =0 ; +enum cfctrl_srv serv; +enum cfctrl_srv servtype; +u8 endpoint; +u8 physlinkid; +u8 prio; +u8 tmp; +u8 *cp; +int i; +struct cfctrl_link_param linkparam; +struct cfctrl_request_info rsp, *req; + +memset (&linkparam,0 ,sizeof (linkparam)); + + tmp =cfpkt_extr_head_u8 (pkt); + + serv = tmp &CFCTRL_SRV_MASK ; + linkparam.linktype = serv; + + servtype = tmp >>4 ; + linkparam.chtype = servtype; + + tmp =cfpkt_extr_head_u8 (pkt); + physlinkid = tmp &0x07 ; + prio = tmp >>3 ; + + linkparam.priority = prio; + linkparam.phyid = physlinkid; + endpoint =cfpkt_extr_head_u8 (pkt); + linkparam.endpoint = endpoint &0x03 ; + +switch (serv) { +case CFCTRL_SRV_VEI : +case CFCTRL_SRV_DBG : +if (CFCTRL_ERR_BIT & cmdrsp) +break ; +/* Link ID */ + linkid =cfpkt_extr_head_u8 (pkt); +break ; +case CFCTRL_SRV_VIDEO : + tmp =cfpkt_extr_head_u8 (pkt); + linkparam.u.video.connid = tmp; +if (CFCTRL_ERR_BIT & cmdrsp) +break ; +/* Link ID */ + linkid =cfpkt_extr_head_u8 (pkt); +break ; + +case CFCTRL_SRV_DATAGRAM : + linkparam.u.datagram.connid =cfpkt_extr_head_u32 (pkt); +if (CFCTRL_ERR_BIT & cmdrsp) +break ; +/* Link ID */ + linkid =cfpkt_extr_head_u8 (pkt); +break ; +case CFCTRL_SRV_RFM : +/* Construct a frame, convert +* DatagramConnectionID +* to network format long and copy it out... +*/ + linkparam.u.rfm.connid =cfpkt_extr_head_u32 (pkt); + cp = (u8 *) linkparam.u.rfm.volume; +for (tmp =cfpkt_extr_head_u8 (pkt); +cfpkt_more (pkt) && tmp !='\0' ; + tmp =cfpkt_extr_head_u8 (pkt)) + *cp++ = tmp; + *cp ='\0' ; + +if (CFCTRL_ERR_BIT & cmdrsp) +break ; +/* Link ID */ + linkid =cfpkt_extr_head_u8 (pkt); + +break ; +case CFCTRL_SRV_UTIL : +/* Construct a frame, convert +* DatagramConnectionID +* to network format long and copy it out... +*/ +/* Fifosize KB */ + linkparam.u.utility.fifosize_kb =cfpkt_extr_head_u16 (pkt); +/* Fifosize bufs */ + linkparam.u.utility.fifosize_bufs =cfpkt_extr_head_u16 (pkt); +/* name */ + cp = (u8 *) linkparam.u.utility.name; +caif_assert (sizeof (linkparam.u.utility.name) + >=UTILITY_NAME_LENGTH ); +for (i =0 ; i <UTILITY_NAME_LENGTH &&cfpkt_more (pkt); i++) { + tmp =cfpkt_extr_head_u8 (pkt); + *cp++ = tmp; + } +/* Length */ + len =cfpkt_extr_head_u8 (pkt); + linkparam.u.utility.paramlen = len; +/* Param Data */ + cp = linkparam.u.utility.params; +while (cfpkt_more (pkt) && len--) { + tmp =cfpkt_extr_head_u8 (pkt); + *cp++ = tmp; + } +if (CFCTRL_ERR_BIT & cmdrsp) +break ; +/* Link ID */ + linkid =cfpkt_extr_head_u8 (pkt); +/* Length */ + len =cfpkt_extr_head_u8 (pkt); +/* Param Data */ +cfpkt_extr_head (pkt,NULL , len); +break ; +default : +pr_warn ("Request setup, invalid type (%d)\n" , serv); +return -1 ; + } + + rsp.cmd =CFCTRL_CMD_LINK_SETUP ; + rsp.param = linkparam; +spin_lock_bh (&cfctrl->info_list_lock); + req =cfctrl_remove_req (cfctrl, &rsp); + +if (CFCTRL_ERR_BIT == (CFCTRL_ERR_BIT & cmdrsp) || +cfpkt_erroneous (pkt)) { +pr_err ("Invalid O/E bit or parse error " +"on CAIF control channel\n" ); + cfctrl->res.reject_rsp (cfctrl->serv.layer.up,0 , + req ? req->client_layer :NULL ); + }else { + cfctrl->res.linksetup_rsp (cfctrl->serv.layer.up, linkid, + serv, physlinkid, + req ? req->client_layer :NULL ); + } + +kfree (req); + +spin_unlock_bh (&cfctrl->info_list_lock); + +return 0 ; +} +static int cfctrl_recv (struct cflayer *layer,struct cfpkt *pkt) {u8 cmdrsp;u8 cmd; -int ret =-1 ; -u8 len; -u8 param[255 ]; +int ret =0 ;u8 linkid =0 ;struct cfctrl *cfctrl =container_obj (layer); -struct cfctrl_request_info rsp, *req; - cmdrsp =cfpkt_extr_head_u8 (pkt); cmd = cmdrsp &CFCTRL_CMD_MASK ;
@@ -374,150 +511,7 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)switch (cmd) {case CFCTRL_CMD_LINK_SETUP : - { -enum cfctrl_srv serv; -enum cfctrl_srv servtype; -u8 endpoint; -u8 physlinkid; -u8 prio; -u8 tmp; -u8 *cp; -int i; -struct cfctrl_link_param linkparam; -memset (&linkparam,0 ,sizeof (linkparam)); - - tmp =cfpkt_extr_head_u8 (pkt); - - serv = tmp &CFCTRL_SRV_MASK ; - linkparam.linktype = serv; - - servtype = tmp >>4 ; - linkparam.chtype = servtype; - - tmp =cfpkt_extr_head_u8 (pkt); - physlinkid = tmp &0x07 ; - prio = tmp >>3 ; - - linkparam.priority = prio; - linkparam.phyid = physlinkid; - endpoint =cfpkt_extr_head_u8 (pkt); - linkparam.endpoint = endpoint &0x03 ; - -switch (serv) { -case CFCTRL_SRV_VEI : -case CFCTRL_SRV_DBG : -if (CFCTRL_ERR_BIT & cmdrsp) -break ; -/* Link ID */ - linkid =cfpkt_extr_head_u8 (pkt); -break ; -case CFCTRL_SRV_VIDEO : - tmp =cfpkt_extr_head_u8 (pkt); - linkparam.u.video.connid = tmp; -if (CFCTRL_ERR_BIT & cmdrsp) -break ; -/* Link ID */ - linkid =cfpkt_extr_head_u8 (pkt); -break ; - -case CFCTRL_SRV_DATAGRAM : - linkparam.u.datagram.connid = -cfpkt_extr_head_u32 (pkt); -if (CFCTRL_ERR_BIT & cmdrsp) -break ; -/* Link ID */ - linkid =cfpkt_extr_head_u8 (pkt); -break ; -case CFCTRL_SRV_RFM : -/* Construct a frame, convert -* DatagramConnectionID -* to network format long and copy it out... -*/ - linkparam.u.rfm.connid = -cfpkt_extr_head_u32 (pkt); - cp = (u8 *) linkparam.u.rfm.volume; -for (tmp =cfpkt_extr_head_u8 (pkt); -cfpkt_more (pkt) && tmp !='\0' ; - tmp =cfpkt_extr_head_u8 (pkt)) - *cp++ = tmp; - *cp ='\0' ; - -if (CFCTRL_ERR_BIT & cmdrsp) -break ; -/* Link ID */ - linkid =cfpkt_extr_head_u8 (pkt); - -break ; -case CFCTRL_SRV_UTIL : -/* Construct a frame, convert -* DatagramConnectionID -* to network format long and copy it out... -*/ -/* Fifosize KB */ - linkparam.u.utility.fifosize_kb = -cfpkt_extr_head_u16 (pkt); -/* Fifosize bufs */ - linkparam.u.utility.fifosize_bufs = -cfpkt_extr_head_u16 (pkt); -/* name */ - cp = (u8 *) linkparam.u.utility.name; -caif_assert (sizeof (linkparam.u.utility.name) - >=UTILITY_NAME_LENGTH ); -for (i =0 ; - i <UTILITY_NAME_LENGTH - &&cfpkt_more (pkt); i++) { - tmp =cfpkt_extr_head_u8 (pkt); - *cp++ = tmp; - } -/* Length */ - len =cfpkt_extr_head_u8 (pkt); - linkparam.u.utility.paramlen = len; -/* Param Data */ - cp = linkparam.u.utility.params; -while (cfpkt_more (pkt) && len--) { - tmp =cfpkt_extr_head_u8 (pkt); - *cp++ = tmp; - } -if (CFCTRL_ERR_BIT & cmdrsp) -break ; -/* Link ID */ - linkid =cfpkt_extr_head_u8 (pkt); -/* Length */ - len =cfpkt_extr_head_u8 (pkt); -/* Param Data */ -cfpkt_extr_head (pkt, ¶m, len); -break ; -default : -pr_warn ("Request setup, invalid type (%d)\n" , - serv); - goto error; - } - - rsp.cmd = cmd; - rsp.param = linkparam; -spin_lock_bh (&cfctrl->info_list_lock); - req =cfctrl_remove_req (cfctrl, &rsp); - -if (CFCTRL_ERR_BIT == (CFCTRL_ERR_BIT & cmdrsp) || -cfpkt_erroneous (pkt)) { -pr_err ("Invalid O/E bit or parse error " -"on CAIF control channel\n" ); - cfctrl->res.reject_rsp (cfctrl->serv.layer.up, -0 , - req ? req->client_layer - :NULL ); - }else { - cfctrl->res.linksetup_rsp (cfctrl->serv. - layer.up, linkid, - serv, physlinkid, - req ? req-> - client_layer :NULL ); - } - -kfree (req); - -spin_unlock_bh (&cfctrl->info_list_lock); - } + ret =cfctrl_link_setup (cfctrl, pkt, cmdrsp);break ;case CFCTRL_CMD_LINK_DESTROY : linkid =cfpkt_extr_head_u8 (pkt);
@@ -544,9 +538,9 @@ static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)break ;default :pr_err ("Unrecognized Control Frame\n" ); + ret =-1 ; goto error; } - ret =0 ; error:cfpkt_destroy (pkt);return ret;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 162/627 net: annotate races around sk->sk_uid
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit e84a4927a404f369c842c19de93b216627fcc690 ]
sk->sk_uid can be read while another thread changes its value in sockfs_setattr().
Add sk_uid(const struct sock *sk) helper to factorize the needed READ_ONCE() annotations, and add corresponding WRITE_ONCE() where needed.
--- include/net/route.h | 4 ++-- include/net/sock.h | 12 ++++++++++-- net/ipv4/inet_connection_sock.c | 4 ++-- net/ipv4/ping.c | 2 +- net/ipv4/raw.c | 2 +- net/ipv4/route.c | 3 ++- net/ipv4/syncookies.c | 3 ++- net/ipv4/udp.c | 3 ++- net/ipv6/af_inet6.c | 2 +- net/ipv6/datagram.c | 2 +- net/ipv6/inet6_connection_sock.c | 4 ++-- net/ipv6/ping.c | 2 +- net/ipv6/raw.c | 2 +- net/ipv6/route.c | 4 ++-- net/ipv6/syncookies.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- net/ipv6/udp.c | 5 +++-- net/l2tp/l2tp_ip6.c | 2 +- net/mptcp/protocol.c | 2 +- net/socket.c | 8 +++++--- 20 files changed, 42 insertions(+), 28 deletions(-)
include/net/route.h +2 -2
@@ -153,7 +153,7 @@ static inline void inet_sk_init_flowi4(const struct inet_sock *inet,ip_sock_rt_tos (sk),ip_sock_rt_scope (sk), sk->sk_protocol,inet_sk_flowi_flags (sk), daddr, inet->inet_saddr, inet->inet_dport, - inet->inet_sport, sk->sk_uid); + inet->inet_sport, sk_uid(sk));security_sk_classify_flow (sk,flowi4_to_flowi_common (fl4)); }
@@ -331,7 +331,7 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst,flowi4_init_output (fl4, oif,READ_ONCE (sk->sk_mark),ip_sock_rt_tos (sk),ip_sock_rt_scope (sk), protocol, flow_flags, dst, - src, dport, sport, sk->sk_uid); + src, dport, sport,sk_uid (sk)); } static inline struct rtable *ip_route_connect(struct flowi4 *fl4, __be32 dst,
include/net/sock.h +10 -2
@@ -2076,6 +2076,7 @@ static inline void sock_orphan(struct sock *sk)sock_set_flag (sk,SOCK_DEAD );sk_set_socket (sk,NULL ); sk->sk_wq =NULL ; +/* Note: sk_uid is unchanged. */ write_unlock_bh (&sk->sk_callback_lock); }
@@ -2086,18 +2087,25 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)rcu_assign_pointer (sk->sk_wq, &parent->wq); parent->sk = sk;sk_set_socket (sk, parent); - sk->sk_uid =SOCK_INODE (parent)->i_uid; +WRITE_ONCE (sk->sk_uid,SOCK_INODE (parent)->i_uid);security_sock_graft (sk, parent);write_unlock_bh (&sk->sk_callback_lock); }kuid_t sock_i_uid (struct sock *sk); + +static inline kuid_t sk_uid (const struct sock *sk) +{ +/* Paired with WRITE_ONCE() in sockfs_setattr() */ +return READ_ONCE (sk->sk_uid); +} +unsigned long __sock_i_ino (struct sock *sk);unsigned long sock_i_ino (struct sock *sk);static inline kuid_t sock_net_uid (const struct net *net,const struct sock *sk) { -return sk ? sk->sk_uid :make_kuid (net->user_ns,0 ); +return sk ?sk_uid (sk) :make_kuid (net->user_ns,0 ); }static inline u32 net_tx_rndhash (void )
net/ipv4/inet_connection_sock.c +2 -2
@@ -812,7 +812,7 @@ struct dst_entry *inet_csk_route_req(const struct sock *sk, sk->sk_protocol,inet_sk_flowi_flags (sk), (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr, ireq->ir_loc_addr, ireq->ir_rmt_port, - htons(ireq->ir_num), sk->sk_uid); + htons(ireq->ir_num), sk_uid(sk));security_req_classify_flow (req,flowi4_to_flowi_common (fl4)); rt =ip_route_output_flow (net, fl4, sk);if (IS_ERR (rt))
@@ -849,7 +849,7 @@ struct dst_entry *inet_csk_route_child_sock(const struct sock *sk, sk->sk_protocol,inet_sk_flowi_flags (sk), (opt && opt->opt.srr) ? opt->opt.faddr : ireq->ir_rmt_addr, ireq->ir_loc_addr, ireq->ir_rmt_port, - htons(ireq->ir_num), sk->sk_uid); + htons(ireq->ir_num), sk_uid(sk));security_req_classify_flow (req,flowi4_to_flowi_common (fl4)); rt =ip_route_output_flow (net, fl4, sk);if (IS_ERR (rt))
net/ipv4/ping.c +1 -1
@@ -781,7 +781,7 @@ static int ping_v4_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)flowi4_init_output (&fl4, ipc.oif, ipc.sockc.mark, ipc.tos &INET_DSCP_MASK , scope, sk->sk_protocol,inet_sk_flowi_flags (sk), faddr, - saddr,0 ,0 , sk->sk_uid); + saddr,0 ,0 ,sk_uid (sk)); fl4.fl4_icmp_type = user_icmph.type; fl4.fl4_icmp_code = user_icmph.code;
net/ipv4/raw.c +1 -1
@@ -610,7 +610,7 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) hdrincl ? ipc.protocol : sk->sk_protocol,inet_sk_flowi_flags (sk) | (hdrincl ?FLOWI_FLAG_KNOWN_NH :0 ), - daddr, saddr, 0, 0, sk->sk_uid); + daddr, saddr, 0, 0, sk_uid(sk)); fl4.fl4_icmp_type =0 ; fl4.fl4_icmp_code =0 ;
net/ipv4/route.c +2 -1
@@ -556,7 +556,8 @@ static void build_sk_flow_key(struct flowi4 *fl4, const struct sock *sk)inet_test_bit (HDRINCL , sk) ?IPPROTO_RAW : sk->sk_protocol,inet_sk_flowi_flags (sk), - daddr, inet->inet_saddr, 0, 0, sk->sk_uid); + daddr, inet->inet_saddr,0 ,0 , + sk_uid(sk));rcu_read_unlock (); }
net/ipv4/syncookies.c +2 -1
@@ -454,7 +454,8 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb)ip_sock_rt_tos (sk),ip_sock_rt_scope (sk),IPPROTO_TCP ,inet_sk_flowi_flags (sk), opt->srr ? opt->faddr : ireq->ir_rmt_addr, - ireq->ir_loc_addr, th->source, th->dest, sk->sk_uid); + ireq->ir_loc_addr, th->source, th->dest, + sk_uid(sk));security_req_classify_flow (req,flowi4_to_flowi_common (&fl4)); rt =ip_route_output_key (net, &fl4);if (IS_ERR (rt)) {
net/ipv4/udp.c +2 -1
@@ -1445,7 +1445,8 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)flowi4_init_output (fl4, ipc.oif, ipc.sockc.mark, ipc.tos &INET_DSCP_MASK , scope, sk->sk_protocol, flow_flags, faddr, saddr, - dport, inet->inet_sport, sk->sk_uid); + dport, inet->inet_sport, +sk_uid (sk));security_sk_classify_flow (sk,flowi4_to_flowi_common (fl4)); rt =ip_route_output_flow (net, fl4, sk);
net/ipv6/af_inet6.c +1 -1
@@ -842,7 +842,7 @@ int inet6_sk_rebuild_header(struct sock *sk) fl6.flowi6_mark = sk->sk_mark; fl6.fl6_dport = inet->inet_dport; fl6.fl6_sport = inet->inet_sport; - fl6.flowi6_uid = sk->sk_uid; + fl6.flowi6_uid =sk_uid (sk);security_sk_classify_flow (sk,flowi6_to_flowi_common (&fl6));rcu_read_lock ();
net/ipv6/datagram.c +1 -1
@@ -53,7 +53,7 @@ static void ip6_datagram_flow_key_init(struct flowi6 *fl6, fl6->fl6_dport = inet->inet_dport; fl6->fl6_sport = inet->inet_sport; fl6->flowlabel =ip6_make_flowinfo (np->tclass, np->flow_label); - fl6->flowi6_uid = sk->sk_uid; + fl6->flowi6_uid =sk_uid (sk);if (!oif) oif = np->sticky_pktinfo.ipi6_ifindex;
net/ipv6/inet6_connection_sock.c +2 -2
@@ -45,7 +45,7 @@ struct dst_entry *inet6_csk_route_req(const struct sock *sk, fl6->flowi6_mark = ireq->ir_mark; fl6->fl6_dport = ireq->ir_rmt_port; fl6->fl6_sport =htons (ireq->ir_num); - fl6->flowi6_uid = sk->sk_uid; + fl6->flowi6_uid =sk_uid (sk);security_req_classify_flow (req,flowi6_to_flowi_common (fl6)); dst =ip6_dst_lookup_flow (sock_net (sk), sk, fl6, final_p);
@@ -79,7 +79,7 @@ static struct dst_entry *inet6_csk_route_socket(struct sock *sk, fl6->flowi6_mark = sk->sk_mark; fl6->fl6_sport = inet->inet_sport; fl6->fl6_dport = inet->inet_dport; - fl6->flowi6_uid = sk->sk_uid; + fl6->flowi6_uid =sk_uid (sk);security_sk_classify_flow (sk,flowi6_to_flowi_common (fl6));rcu_read_lock ();
net/ipv6/ping.c +1 -1
@@ -142,7 +142,7 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) fl6.saddr = np->saddr; fl6.daddr = *daddr; fl6.flowi6_mark = ipc6.sockc.mark; - fl6.flowi6_uid = sk->sk_uid; + fl6.flowi6_uid =sk_uid (sk); fl6.fl6_icmp_type = user_icmph.icmp6_type; fl6.fl6_icmp_code = user_icmph.icmp6_code;security_sk_classify_flow (sk,flowi6_to_flowi_common (&fl6));
net/ipv6/raw.c +1 -1
@@ -777,7 +777,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)memset (&fl6,0 ,sizeof (fl6)); fl6.flowi6_mark = ipc6.sockc.mark; - fl6.flowi6_uid = sk->sk_uid; + fl6.flowi6_uid =sk_uid (sk);if (sin6) {if (addr_len <SIN6_LEN_RFC2133 )
net/ipv6/route.c +2 -2
@@ -3010,7 +3010,7 @@ void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu) oif =l3mdev_master_ifindex (skb->dev);ip6_update_pmtu (skb,sock_net (sk), mtu, oif,READ_ONCE (sk->sk_mark), - sk->sk_uid); +sk_uid (sk)); dst =__sk_dst_get (sk); if (!dst || !dst->obsolete ||
@@ -3232,7 +3232,7 @@ void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif)void ip6_sk_redirect (struct sk_buff *skb,struct sock *sk) {ip6_redirect (skb,sock_net (sk), sk->sk_bound_dev_if, -READ_ONCE (sk->sk_mark), sk->sk_uid); +READ_ONCE (sk->sk_mark),sk_uid (sk)); }EXPORT_SYMBOL_GPL (ip6_sk_redirect);
net/ipv6/syncookies.c +1 -1
@@ -236,7 +236,7 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) fl6.flowi6_mark = ireq->ir_mark; fl6.fl6_dport = ireq->ir_rmt_port; fl6.fl6_sport =inet_sk (sk)->inet_sport; - fl6.flowi6_uid = sk->sk_uid; + fl6.flowi6_uid =sk_uid (sk);security_req_classify_flow (req,flowi6_to_flowi_common (&fl6)); dst =ip6_dst_lookup_flow (net, sk, &fl6, final_p);
net/ipv6/tcp_ipv6.c +1 -1
@@ -269,7 +269,7 @@ static int tcp_v6_connect(struct sock *sk, struct sockaddr *uaddr, fl6.fl6_sport = inet->inet_sport;if (IS_ENABLED (CONFIG_IP_ROUTE_MULTIPATH ) && !fl6.fl6_sport) fl6.flowi6_flags =FLOWI_FLAG_ANY_SPORT ; - fl6.flowi6_uid = sk->sk_uid; + fl6.flowi6_uid =sk_uid (sk); opt =rcu_dereference_protected (np->opt,lockdep_sock_is_held (sk)); final_p =fl6_update_dst (&fl6, opt, &final);
net/ipv6/udp.c +3 -2
@@ -750,7 +750,8 @@ int __udp6_lib_err(struct sk_buff *skb, struct inet6_skb_parm *opt,if (type ==NDISC_REDIRECT ) {if (tunnel) {ip6_redirect (skb,sock_net (sk),inet6_iif (skb), -READ_ONCE (sk->sk_mark), sk->sk_uid); +READ_ONCE (sk->sk_mark), +sk_uid (sk)); }else {ip6_sk_redirect (skb, sk); }
@@ -1620,7 +1621,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)if (!fl6->flowi6_oif) fl6->flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; - fl6->flowi6_uid = sk->sk_uid; + fl6->flowi6_uid =sk_uid (sk);if (msg->msg_controllen) { opt = &opt_space;
net/l2tp/l2tp_ip6.c +1 -1
@@ -545,7 +545,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)memset (&fl6,0 ,sizeof (fl6)); fl6.flowi6_mark =READ_ONCE (sk->sk_mark); - fl6.flowi6_uid = sk->sk_uid; + fl6.flowi6_uid =sk_uid (sk);ipcm6_init_sk (&ipc6, sk);
net/mptcp/protocol.c +1 -1
@@ -3537,7 +3537,7 @@ void mptcp_sock_graft(struct sock *sk, struct socket *parent)write_lock_bh (&sk->sk_callback_lock);rcu_assign_pointer (sk->sk_wq, &parent->wq);sk_set_socket (sk, parent); - sk->sk_uid =SOCK_INODE (parent)->i_uid; +WRITE_ONCE (sk->sk_uid,SOCK_INODE (parent)->i_uid);write_unlock_bh (&sk->sk_callback_lock); }
net/socket.c +5 -3
@@ -592,10 +592,12 @@ static int sockfs_setattr(struct mnt_idmap *idmap,if (!err && (iattr->ia_valid &ATTR_UID )) {struct socket *sock =SOCKET_I (d_inode (dentry)); -if (sock->sk) - sock->sk->sk_uid = iattr->ia_uid; -else +if (sock->sk) { +/* Paired with READ_ONCE() in sk_uid() */ +WRITE_ONCE (sock->sk->sk_uid, iattr->ia_uid); + }else { err = -ENOENT ; + } }return err;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 163/627 wifi: rtw89: avoid NULL dereference when RX problematic packet on unsupported 6 GHz band
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zong-Zhe Yang <[email protected]>
[ Upstream commit 7e04f01bb94fe61c73cc59f0495c3b6c16a83231 ]
With a quite rare chance, RX report might be problematic to make SW think a packet is received on 6 GHz band even if the chip does not support 6 GHz band actually. Since SW won't initialize stuffs for unsupported bands, NULL dereference will happen then in the sequence, rtw89_vif_rx_stats_iter() -> rtw89_core_cancel_6ghz_probe_tx(). So, add a check to avoid it.
The following is a crash log for this case.
BUG: kernel NULL pointer dereference, address: 0000000000000032 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: 0000 [#1] PREEMPT SMP NOPTI CPU: 1 PID: 1907 Comm: irq/131-rtw89_p Tainted: G U 6.6.56-05896-g89f5fb0eb30b #1 (HASH:1400 4) Hardware name: Google Telith/Telith, BIOS Google_Telith.15217.747.0 11/12/2024 RIP: 0010:rtw89_vif_rx_stats_iter+0xd2/0x310 [rtw89_core] Code: 4c 89 7d c8 48 89 55 c0 49 8d 44 24 02 48 89 45 b8 45 31 ff eb 11 41 c6 45 3a 01 41 b7 01 4d 8b 6d 00 4d 39 f5 74 42 8b 43 10 <41> 33 45 32 0f b7 4b 14 66 41 33 4d 36 0f b7 c9 09 c1 74 d8 4d 85 RSP: 0018:ffff9f3080138ca0 EFLAGS: 00010246 RAX: 00000000b8bf5770 RBX: ffff91b5e8c639c0 RCX: 0000000000000011 RDX: ffff91b582de1be8 RSI: 0000000000000000 RDI: ffff91b5e8c639e6 RBP: ffff9f3080138d00 R08: 0000000000000000 R09: 0000000000000000 R10: ffff91b59de70000 R11: ffffffffc069be50 R12: ffff91b5e8c639e4 R13: 0000000000000000 R14: ffff91b5828020b8 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff91b8efa40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000032 CR3: 00000002bf838000 CR4: 0000000000750ee0 PKRU: 55555554 Call Trace: <IRQ> ? __die_body+0x68/0xb0 ? page_fault_oops+0x379/0x3e0 ? exc_page_fault+0x4f/0xa0 ? asm_exc_page_fault+0x22/0x30 ? __pfx_rtw89_vif_rx_stats_iter+0x10/0x10 [rtw89_core (HASH:1400 5)] ? rtw89_vif_rx_stats_iter+0xd2/0x310 [rtw89_core (HASH:1400 5)] __iterate_interfaces+0x59/0x110 [mac80211 (HASH:1400 6)] ? __pfx_rtw89_vif_rx_stats_iter+0x10/0x10 [rtw89_core (HASH:1400 5)] ? __pfx_rtw89_vif_rx_stats_iter+0x10/0x10 [rtw89_core (HASH:1400 5)] ieee80211_iterate_active_interfaces_atomic+0x36/0x50 [mac80211 (HASH:1400 6)] rtw89_core_rx_to_mac80211+0xfd/0x1b0 [rtw89_core (HASH:1400 5)] rtw89_core_rx+0x43a/0x980 [rtw89_core (HASH:1400 5)]
--- drivers/net/wireless/realtek/rtw89/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtw89/core.c +5 -0
@@ -2158,6 +2158,11 @@ static void rtw89_core_cancel_6ghz_probe_tx(struct rtw89_dev *rtwdev,if (rx_status->band !=NL80211_BAND_6GHZ )return ; +if (unlikely (!(rtwdev->chip->support_bands &BIT (NL80211_BAND_6GHZ )))) { +rtw89_debug (rtwdev,RTW89_DBG_UNEXP ,"invalid rx on unsupported 6 GHz\n" ); +return ; + } + ssid_ie =cfg80211_find_ie (WLAN_EID_SSID , ies, skb->len);list_for_each_entry (info, &pkt_list[NL80211_BAND_6GHZ ], list) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 164/627 wifi: rtl818x: Kill URBs before clearing tx status queue
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniil Dulov <[email protected]>
[ Upstream commit 16d8fd74dbfca0ea58645cd2fca13be10cae3cdd ]
In rtl8187_stop() move the call of usb_kill_anchored_urbs() before clearing b_tx_status.queue. This change prevents callbacks from using already freed skb due to anchor was not killed before freeing such skb.
BUG: kernel NULL pointer dereference, address: 0000000000000080 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 0 P4D 0 Oops: Oops: 0000 [#1] SMP NOPTI CPU: 7 UID: 0 PID: 0 Comm: swapper/7 Not tainted 6.15.0 #8 PREEMPT(voluntary) Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 0.0.0 02/06/2015 RIP: 0010:ieee80211_tx_status_irqsafe+0x21/0xc0 [mac80211] Call Trace: <IRQ> rtl8187_tx_cb+0x116/0x150 [rtl8187] __usb_hcd_giveback_urb+0x9d/0x120 usb_giveback_urb_bh+0xbb/0x140 process_one_work+0x19b/0x3c0 bh_worker+0x1a7/0x210 tasklet_action+0x10/0x30 handle_softirqs+0xf0/0x340 __irq_exit_rcu+0xcd/0xf0 common_interrupt+0x85/0xa0 </IRQ>
Tested on RTL8187BvE device.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl818x/rtl8187/dev.c +2 -1
@@ -1041,10 +1041,11 @@ static void rtl8187_stop(struct ieee80211_hw *dev, bool suspend)rtl818x_iowrite8 (priv, &priv->map->CONFIG4, reg |RTL818X_CONFIG4_VCOOFF );rtl818x_iowrite8 (priv, &priv->map->EEPROM_CMD,RTL818X_EEPROM_CMD_NORMAL ); +usb_kill_anchored_urbs (&priv->anchored); +while ((skb =skb_dequeue (&priv->b_tx_status.queue)))dev_kfree_skb_any (skb); -usb_kill_anchored_urbs (&priv->anchored);mutex_unlock (&priv->conf_mutex);if (!priv->is_rtl8187b)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 165/627 drm/amdgpu: fix slab-use-after-free in amdgpu_userq_mgr_fini+0x70c
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Prosyak <[email protected]>
[ Upstream commit 5fb90421fa0fbe0a968274912101fe917bf1c47b ]
The issue was reproduced on NV10 using IGT pci_unplug test.
It is expected that amdgpu_driver_postclose_kms() is called prior to amdgpu_drm_release(). However, the bug is that amdgpu_fpriv was freed in amdgpu_driver_postclose_kms(), and then later accessed in amdgpu_drm_release() via a call to amdgpu_userq_mgr_fini(). As a result, KASAN detected a use-after-free condition, as shown in the log below. The proposed fix is to move the calls to amdgpu_eviction_fence_destroy() and amdgpu_userq_mgr_fini() into amdgpu_driver_postclose_kms(), so they are invoked before amdgpu_fpriv is freed.
This also ensures symmetry with the initialization path in amdgpu_driver_open_kms(), where the following components are initialized:
- amdgpu_userq_mgr_init()
- amdgpu_eviction_fence_init()
- amdgpu_ctx_mgr_init()
Correspondingly, in amdgpu_driver_postclose_kms() we should clean up using:
- amdgpu_userq_mgr_fini()
- amdgpu_eviction_fence_destroy()
- amdgpu_ctx_mgr_fini()
This change eliminates the use-after-free and improves consistency in resource management between open and close paths.
[ +0.094367] ================================================================== [ +0.000026] BUG: KASAN: slab-use-after-free in amdgpu_userq_mgr_fini+0x70c/0x730 [amdgpu] [ +0.000866] Write of size 8 at addr ffff88811c068c60 by task amd_pci_unplug/1737 [ +0.000026] CPU: 3 UID: 0 PID: 1737 Comm: amd_pci_unplug Not tainted 6.14.0+ #2 [ +0.000008] Hardware name: ASUS System Product Name/ROG STRIX B550-F GAMING (WI-FI), BIOS 1401 12/03/2020 [ +0.000004] Call Trace: [ +0.000004] <TASK> [ +0.000003] dump_stack_lvl+0x76/0xa0 [ +0.000010] print_report+0xce/0x600 [ +0.000009] ? amdgpu_userq_mgr_fini+0x70c/0x730 [amdgpu] [ +0.000790] ? srso_return_thunk+0x5/0x5f [ +0.000007] ? kasan_complete_mode_report_info+0x76/0x200 [ +0.000008] ? amdgpu_userq_mgr_fini+0x70c/0x730 [amdgpu] [ +0.000684] kasan_report+0xbe/0x110 [ +0.000007] ? amdgpu_userq_mgr_fini+0x70c/0x730 [amdgpu] [ +0.000601] __asan_report_store8_noabort+0x17/0x30 [ +0.000007] amdgpu_userq_mgr_fini+0x70c/0x730 [amdgpu] [ +0.000801] ? __pfx_amdgpu_userq_mgr_fini+0x10/0x10 [amdgpu] [ +0.000819] ? srso_return_thunk+0x5/0x5f [ +0.000008] amdgpu_drm_release+0xa3/0xe0 [amdgpu] [ +0.000604] __fput+0x354/0xa90 [ +0.000010] __fput_sync+0x59/0x80 [ +0.000005] __x64_sys_close+0x7d/0xe0 [ +0.000006] x64_sys_call+0x2505/0x26f0 [ +0.000006] do_syscall_64+0x7c/0x170 [ +0.000004] ? kasan_record_aux_stack+0xae/0xd0 [ +0.000005] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? kmem_cache_free+0x398/0x580 [ +0.000006] ? __fput+0x543/0xa90 [ +0.000006] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? __fput+0x543/0xa90 [ +0.000004] ? __kasan_check_read+0x11/0x20 [ +0.000007] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? __kasan_check_read+0x11/0x20 [ +0.000003] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? fpregs_assert_state_consistent+0x21/0xb0 [ +0.000006] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? syscall_exit_to_user_mode+0x4e/0x240 [ +0.000005] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? do_syscall_64+0x88/0x170 [ +0.000003] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? do_syscall_64+0x88/0x170 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? irqentry_exit+0x43/0x50 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? exc_page_fault+0x7c/0x110 [ +0.000006] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ +0.000005] RIP: 0033:0x7ffff7b14f67 [ +0.000005] Code: ff e8 0d 16 02 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 41 c3 48 83 ec 18 89 7c 24 0c e8 73 ba f7 ff [ +0.000004] RSP: 002b:00007fffffffe358 EFLAGS: 00000246 ORIG_RAX: 0000000000000003 [ +0.000006] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007ffff7b14f67 [ +0.000003] RDX: 0000000000000000 RSI: 00007ffff7f5755a RDI: 0000000000000003 [ +0.000003] RBP: 00007fffffffe380 R08: 0000555555568170 R09: 0000000000000000 [ +0.000003] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fffffffe5c8 [ +0.000003] R13: 00005555555552a9 R14: 0000555555557d48 R15: 00007ffff7ffd040 [ +0.000007] </TASK>
[ +0.000286] Allocated by task 425 on cpu 11 at 29.751192s: [ +0.000013] kasan_save_stack+0x28/0x60 [ +0.000008] kasan_save_track+0x18/0x70 [ +0.000006] kasan_save_alloc_info+0x38/0x60 [ +0.000006] __kasan_kmalloc+0xc1/0xd0 [ +0.000005] __kmalloc_cache_noprof+0x1bd/0x430 [ +0.000006] amdgpu_driver_open_kms+0x172/0x760 [amdgpu] [ +0.000521] drm_file_alloc+0x569/0x9a0 [ +0.000008] drm_client_init+0x1b7/0x410 [ +0.000007] drm_fbdev_client_setup+0x174/0x470 [ +0.000007] drm_client_setup+0x8a/0xf0 [ +0.000006] amdgpu_pci_probe+0x50b/0x10d0 [amdgpu] [ +0.000482] local_pci_probe+0xe7/0x1b0 [ +0.000008] pci_device_probe+0x5bf/0x890 [ +0.000005] really_probe+0x1fd/0x950 [ +0.000007] __driver_probe_device+0x307/0x410 [ +0.000005] driver_probe_device+0x4e/0x150 [ +0.000006] __driver_attach+0x223/0x510 [ +0.000005] bus_for_each_dev+0x102/0x1a0 [ +0.000006] driver_attach+0x3d/0x60 [ +0.000005] bus_add_driver+0x309/0x650 [ +0.000005] driver_register+0x13d/0x490 [ +0.000006] __pci_register_driver+0x1ee/0x2b0 [ +0.000006] xfrm_ealg_get_byidx+0x43/0x50 [xfrm_algo] [ +0.000008] do_one_initcall+0x9c/0x3e0 [ +0.000007] do_init_module+0x29e/0x7f0 [ +0.000006] load_module+0x5c75/0x7c80 [ +0.000006] init_module_from_file+0x106/0x180 [ +0.000007] idempotent_init_module+0x377/0x740 [ +0.000006] __x64_sys_finit_module+0xd7/0x180 [ +0.000006] x64_sys_call+0x1f0b/0x26f0 [ +0.000006] do_syscall_64+0x7c/0x170 [ +0.000005] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ +0.000013] Freed by task 1737 on cpu 9 at 76.455063s: [ +0.000010] kasan_save_stack+0x28/0x60 [ +0.000006] kasan_save_track+0x18/0x70 [ +0.000005] kasan_save_free_info+0x3b/0x60 [ +0.000006] __kasan_slab_free+0x54/0x80 [ +0.000005] kfree+0x127/0x470 [ +0.000006] amdgpu_driver_postclose_kms+0x455/0x760 [amdgpu] [ +0.000485] drm_file_free.part.0+0x5b1/0xba0 [ +0.000007] drm_file_free+0x13/0x30 [ +0.000006] drm_client_release+0x1c4/0x2b0 [ +0.000006] drm_fbdev_ttm_fb_destroy+0xd2/0x120 [drm_ttm_helper] [ +0.000007] put_fb_info+0x97/0xe0 [ +0.000006] unregister_framebuffer+0x197/0x380 [ +0.000005] drm_fb_helper_unregister_info+0x94/0x100 [ +0.000005] drm_fbdev_client_unregister+0x3c/0x80 [ +0.000007] drm_client_dev_unregister+0x144/0x330 [ +0.000006] drm_dev_unregister+0x49/0x1b0 [ +0.000006] drm_dev_unplug+0x4c/0xd0 [ +0.000006] amdgpu_pci_remove+0x58/0x130 [amdgpu] [ +0.000482] pci_device_remove+0xae/0x1e0 [ +0.000006] device_remove+0xc7/0x180 [ +0.000006] device_release_driver_internal+0x3d4/0x5a0 [ +0.000007] device_release_driver+0x12/0x20 [ +0.000006] pci_stop_bus_device+0x104/0x150 [ +0.000006] pci_stop_and_remove_bus_device_locked+0x1b/0x40 [ +0.000005] remove_store+0xd7/0xf0 [ +0.000007] dev_attr_store+0x3f/0x80 [ +0.000006] sysfs_kf_write+0x125/0x1d0 [ +0.000005] kernfs_fop_write_iter+0x2ea/0x490 [ +0.000007] vfs_write+0x90d/0xe70 [ +0.000006] ksys_write+0x119/0x220 [ +0.000006] __x64_sys_write+0x72/0xc0 [ +0.000006] x64_sys_call+0x18ab/0x26f0 [ +0.000005] do_syscall_64+0x7c/0x170 [ +0.000005] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ +0.000013] The buggy address belongs to the object at ffff88811c068000
which belongs to the cache kmalloc-rnd-01-4k of size 4096
[ +0.000016] The buggy address is located 3168 bytes inside of
freed 4096-byte region [ffff88811c068000, ffff88811c069000)
[ +0.000022] The buggy address belongs to the physical page: [ +0.000010] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88811c06e000 pfn:0x11c068 [ +0.000006] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ +0.000006] flags: 0x17ffffc0000040(head|node=0|zone=2|lastcpupid=0x1fffff) [ +0.000007] page_type: f5(slab) [ +0.000007] raw: 0017ffffc0000040 ffff88810004c140 dead000000000122 0000000000000000 [ +0.000005] raw: ffff88811c06e000 0000000080040002 00000000f5000000 0000000000000000 [ +0.000006] head: 0017ffffc0000040 ffff88810004c140 dead000000000122 0000000000000000 [ +0.000005] head: ffff88811c06e000 0000000080040002 00000000f5000000 0000000000000000 [ +0.000006] head: 0017ffffc0000003 ffffea0004701a01 ffffffffffffffff 0000000000000000 [ +0.000005] head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 [ +0.000004] page dumped because: kasan: bad access detected
[ +0.000011] Memory state around the buggy address: [ +0.000009] ffff88811c068b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000012] ffff88811c068b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] >ffff88811c068c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] ^ [ +0.000010] ffff88811c068c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] ffff88811c068d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] ==================================================================
v2: drop amdgpu_drm_release() and assign drm_release()
as the callback directly.(Alex)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 16 +--------------- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 +++ 2 files changed, 4 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -15
@@ -2906,20 +2906,6 @@ static int amdgpu_pmops_runtime_idle(struct device *dev)return ret; } -static int amdgpu_drm_release (struct inode *inode,struct file *filp) -{ -struct drm_file *file_priv = filp->private_data; -struct amdgpu_fpriv *fpriv = file_priv->driver_priv; - -if (fpriv) { - fpriv->evf_mgr.fd_closing = true; -amdgpu_eviction_fence_destroy (&fpriv->evf_mgr); -amdgpu_userq_mgr_fini (&fpriv->userq_mgr); - } - -return drm_release (inode, filp); -} -long amdgpu_drm_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {
@@ -2971,7 +2957,7 @@ static const struct file_operations amdgpu_driver_kms_fops = { .owner = THIS_MODULE, .open = drm_open, .flush = amdgpu_flush, - .release = amdgpu_drm_release, + .release = drm_release, .unlocked_ioctl = amdgpu_drm_ioctl, .mmap = drm_gem_mmap, .poll = drm_poll,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -0
@@ -1501,6 +1501,9 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,amdgpu_vm_bo_del (adev, fpriv->prt_va);amdgpu_bo_unreserve (pd); } + fpriv->evf_mgr.fd_closing = true; +amdgpu_eviction_fence_destroy (&fpriv->evf_mgr); +amdgpu_userq_mgr_fini (&fpriv->userq_mgr);amdgpu_ctx_mgr_fini (&fpriv->ctx_mgr);amdgpu_vm_fini (adev, &fpriv->vm);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 166/627 wifi: iwlwifi: Fix memory leak in iwl_mvm_init()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiu Jianfeng <[email protected]>
[ Upstream commit ed2e916c890944633d6826dce267579334f63ea5 ]
When iwl_opmode_register() fails, it does not unregster rate control, which will cause a memory leak issue, this patch fixes it.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +3 -1
@@ -61,8 +61,10 @@ static int __init iwl_mvm_init(void) } ret =iwl_opmode_register ("iwlmvm" , &iwl_mvm_ops); -if (ret) +if (ret) {pr_err ("Unable to register MVM op_mode: %d\n" , ret); +iwl_mvm_rate_control_unregister (); + }return ret; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 167/627 iwlwifi: Add missing check for alloc_ordered_workqueue
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 90a0d9f339960448a3acc1437a46730f975efd6a ]
Add check for the return value of alloc_ordered_workqueue since it may return NULL pointer.
--- drivers/net/wireless/intel/iwlwifi/dvm/main.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/dvm/main.c +9 -2
@@ -1049,9 +1049,11 @@ static void iwl_bg_restart(struct work_struct *data)* *****************************************************************************/ -static void iwl_setup_deferred_work (struct iwl_priv *priv) +static int iwl_setup_deferred_work (struct iwl_priv *priv) { priv->workqueue =alloc_ordered_workqueue (DRV_NAME ,0 ); +if (!priv->workqueue) +return -ENOMEM ;INIT_WORK (&priv->restart, iwl_bg_restart);INIT_WORK (&priv->beacon_update, iwl_bg_beacon_update);
@@ -1068,6 +1070,8 @@ static void iwl_setup_deferred_work(struct iwl_priv *priv)timer_setup (&priv->statistics_periodic, iwl_bg_statistics_periodic,0 );timer_setup (&priv->ucode_trace, iwl_bg_ucode_trace,0 ); + +return 0 ; }void iwl_cancel_deferred_work (struct iwl_priv *priv)
@@ -1463,7 +1467,9 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,/******************** * 6. Setup services ********************/ -iwl_setup_deferred_work (priv); +if (iwl_setup_deferred_work (priv)) + goto out_uninit_drv; +iwl_setup_rx_handlers (priv);iwl_power_initialize (priv);
@@ -1502,6 +1508,7 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,iwl_cancel_deferred_work (priv);destroy_workqueue (priv->workqueue); priv->workqueue =NULL ; +out_uninit_drv:iwl_uninit_drv (priv); out_free_eeprom_blob:kfree (priv->eeprom_blob);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 168/627 drm/xe/uapi: Correct sync type definition in comments
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuicheng Lin <[email protected]>
[ Upstream commit 771f002ef1d6f6c2b9bddf779abd31da6b9ccd25 ]
Commit 37d078e51b4c ("drm/xe/uapi: Split xe_sync types from flags") renamed some DRM_XE_SYNC_* defines but later commits kept using the old names. Correct them with the new definition.
v2: correct fixes tag and update commit message to explain why (Lucas)
--- include/uapi/drm/xe_drm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
include/uapi/drm/xe_drm.h +4 -4
@@ -925,9 +925,9 @@ struct drm_xe_gem_mmap_offset {* - %DRM_XE_VM_CREATE_FLAG_LR_MODE - An LR, or Long Running VM accepts * exec submissions to its exec_queues that don't have an upper time * limit on the job execution time. But exec submissions to these -* don't allow any of the flags DRM_XE_SYNC_FLAG_SYNCOBJ, -* DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ, DRM_XE_SYNC_FLAG_DMA_BUF, -* used as out-syncobjs, that is, together with DRM_XE_SYNC_FLAG_SIGNAL. +* don't allow any of the sync types DRM_XE_SYNC_TYPE_SYNCOBJ, +* DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ, used as out-syncobjs, that is, +* together with sync flag DRM_XE_SYNC_FLAG_SIGNAL. * LR VMs can be created in recoverable page-fault mode using * DRM_XE_VM_CREATE_FLAG_FAULT_MODE, if the device supports it. * If that flag is omitted, the UMD can not rely on the slightly
@@ -1394,7 +1394,7 @@ struct drm_xe_sync {/** * @timeline_value: Input for the timeline sync object. Needs to be -* different than 0 when used with %DRM_XE_SYNC_FLAG_TIMELINE_SYNCOBJ. +* different than 0 when used with %DRM_XE_SYNC_TYPE_TIMELINE_SYNCOBJ. */ __u64 timeline_value;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 169/627 team: replace team lock with rtnl lock
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislav Fomichev <[email protected]>
[ Upstream commit bfb4fb77f9a8ce33ce357224569eae5564eec573 ]
syszbot reports various ordering issues for lower instance locks and team lock. Switch to using rtnl lock for protecting team device, similar to bonding. Based on the patch by Tetsuo Handa.
--- drivers/net/team/team_core.c | 96 +++++++++++------------ drivers/net/team/team_mode_activebackup.c | 3 +- drivers/net/team/team_mode_loadbalance.c | 13 ++- include/linux/if_team.h | 3 - 4 files changed, 50 insertions(+), 65 deletions(-)
drivers/net/team/team_core.c +44 -52
@@ -933,7 +933,7 @@ static bool team_port_find(const struct team *team,* Enable/disable port by adding to enabled port hashlist and setting * port->index (Might be racy so reader could see incorrect ifindex when * processing a flying packet, but that is not a problem). Write guarded -* by team->lock. +* by RTNL. */ static void team_port_enable (struct team *team,struct team_port *port)
@@ -1660,8 +1660,6 @@ static int team_init(struct net_device *dev) goto err_options_register;netif_carrier_off (dev); -lockdep_register_key (&team->team_lock_key); -__mutex_init (&team->lock,"team->team_lock_key" , &team->team_lock_key);netdev_lockdep_set_classes (dev);return 0 ;
@@ -1682,7 +1680,8 @@ static void team_uninit(struct net_device *dev)struct team_port *port;struct team_port *tmp; -mutex_lock (&team->lock); +ASSERT_RTNL (); +list_for_each_entry_safe (port, tmp, &team->port_list, list)team_port_del (team, port->dev);
@@ -1691,9 +1690,7 @@ static void team_uninit(struct net_device *dev)team_mcast_rejoin_fini (team);team_notify_peers_fini (team);team_queue_override_fini (team); -mutex_unlock (&team->lock);netdev_change_features (dev); -lockdep_unregister_key (&team->team_lock_key); }static void team_destructor (struct net_device *dev)
@@ -1778,7 +1775,8 @@ static void team_change_rx_flags(struct net_device *dev, int change)struct team_port *port;int inc; -mutex_lock (&team->lock); +ASSERT_RTNL (); +list_for_each_entry (port, &team->port_list, list) {if (change &IFF_PROMISC ) { inc = dev->flags &IFF_PROMISC ?1 :-1 ;
@@ -1789,7 +1787,6 @@ static void team_change_rx_flags(struct net_device *dev, int change)dev_set_allmulti (port->dev, inc); } } -mutex_unlock (&team->lock); }static void team_set_rx_mode (struct net_device *dev)
@@ -1811,14 +1808,14 @@ static int team_set_mac_address(struct net_device *dev, void *p)struct team *team =netdev_priv (dev);struct team_port *port; +ASSERT_RTNL (); +if (dev->type ==ARPHRD_ETHER && !is_valid_ether_addr (addr->sa_data))return -EADDRNOTAVAIL ;dev_addr_set (dev, addr->sa_data); -mutex_lock (&team->lock);list_for_each_entry (port, &team->port_list, list)if (team->ops.port_change_dev_addr) team->ops.port_change_dev_addr (team, port); -mutex_unlock (&team->lock);return 0 ; }
@@ -1828,11 +1825,8 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)struct team_port *port;int err; -/* -* Alhough this is reader, it's guarded by team lock. It's not possible -* to traverse list in reverse under rcu_read_lock -*/ -mutex_lock (&team->lock); +ASSERT_RTNL (); + team->port_mtu_change_allowed = true;list_for_each_entry (port, &team->port_list, list) { err =dev_set_mtu (port->dev, new_mtu);
@@ -1843,7 +1837,6 @@ static int team_change_mtu(struct net_device *dev, int new_mtu) } } team->port_mtu_change_allowed = false; -mutex_unlock (&team->lock);WRITE_ONCE (dev->mtu, new_mtu);
@@ -1853,7 +1846,6 @@ static int team_change_mtu(struct net_device *dev, int new_mtu)list_for_each_entry_continue_reverse (port, &team->port_list, list)dev_set_mtu (port->dev, dev->mtu); team->port_mtu_change_allowed = false; -mutex_unlock (&team->lock);return err; }
@@ -1903,24 +1895,19 @@ static int team_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid)struct team_port *port;int err; -/* -* Alhough this is reader, it's guarded by team lock. It's not possible -* to traverse list in reverse under rcu_read_lock -*/ -mutex_lock (&team->lock); +ASSERT_RTNL (); +list_for_each_entry (port, &team->port_list, list) { err =vlan_vid_add (port->dev, proto, vid);if (err) goto unwind; } -mutex_unlock (&team->lock);return 0 ; unwind:list_for_each_entry_continue_reverse (port, &team->port_list, list)vlan_vid_del (port->dev, proto, vid); -mutex_unlock (&team->lock);return err; }
@@ -1930,10 +1917,10 @@ static int team_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)struct team *team =netdev_priv (dev);struct team_port *port; -mutex_lock (&team->lock); +ASSERT_RTNL (); +list_for_each_entry (port, &team->port_list, list)vlan_vid_del (port->dev, proto, vid); -mutex_unlock (&team->lock);return 0 ; }
@@ -1955,9 +1942,9 @@ static void team_netpoll_cleanup(struct net_device *dev) {struct team *team =netdev_priv (dev); -mutex_lock (&team->lock); +ASSERT_RTNL (); +__team_netpoll_cleanup (team); -mutex_unlock (&team->lock); }static int team_netpoll_setup (struct net_device *dev)
@@ -1966,7 +1953,8 @@ static int team_netpoll_setup(struct net_device *dev)struct team_port *port;int err =0 ; -mutex_lock (&team->lock); +ASSERT_RTNL (); +list_for_each_entry (port, &team->port_list, list) { err =__team_port_enable_netpoll (port);if (err) {
@@ -1974,7 +1962,6 @@ static int team_netpoll_setup(struct net_device *dev) break; } } -mutex_unlock (&team->lock);return err; }#endif
@@ -1985,9 +1972,9 @@ static int team_add_slave(struct net_device *dev, struct net_device *port_dev,struct team *team =netdev_priv (dev);int err; -mutex_lock (&team->lock); +ASSERT_RTNL (); + err =team_port_add (team, port_dev, extack); -mutex_unlock (&team->lock);if (!err)netdev_change_features (dev);
@@ -2000,18 +1987,13 @@ static int team_del_slave(struct net_device *dev, struct net_device *port_dev)struct team *team =netdev_priv (dev);int err; -mutex_lock (&team->lock); +ASSERT_RTNL (); + err =team_port_del (team, port_dev); -mutex_unlock (&team->lock);if (err)return err; -if (netif_is_team_master (port_dev)) { -lockdep_unregister_key (&team->team_lock_key); -lockdep_register_key (&team->team_lock_key); -lockdep_set_class (&team->lock, &team->team_lock_key); - }netdev_change_features (dev);return err;
@@ -2304,9 +2286,10 @@ int team_nl_noop_doit(struct sk_buff *skb, struct genl_info *info)static struct team *team_nl_team_get (struct genl_info *info) {struct net *net =genl_info_net (info); -int ifindex;struct net_device *dev; -struct team *team; +int ifindex; + +ASSERT_RTNL ();if (!info->attrs[TEAM_ATTR_TEAM_IFINDEX ])return NULL ;
@@ -2318,14 +2301,11 @@ static struct team *team_nl_team_get(struct genl_info *info)return NULL ; } - team =netdev_priv (dev); -mutex_lock (&team->lock); -return team; +return netdev_priv (dev); }static void team_nl_team_put (struct team *team) { -mutex_unlock (&team->lock);dev_put (team->dev); }
@@ -2515,9 +2495,13 @@ int team_nl_options_get_doit(struct sk_buff *skb, struct genl_info *info)int err;LIST_HEAD (sel_opt_inst_list); +rtnl_lock (); + team =team_nl_team_get (info); -if (!team) -return -EINVAL ; +if (!team) { + err = -EINVAL ; + goto rtnl_unlock; + }list_for_each_entry (opt_inst, &team->option_inst_list, list)list_add_tail (&opt_inst->tmp_list, &sel_opt_inst_list);
@@ -2527,6 +2511,9 @@ int team_nl_options_get_doit(struct sk_buff *skb, struct genl_info *info)team_nl_team_put (team); +rtnl_unlock: +rtnl_unlock (); +return err; }
@@ -2805,15 +2792,22 @@ int team_nl_port_list_get_doit(struct sk_buff *skb,struct team *team;int err; +rtnl_lock (); + team =team_nl_team_get (info); -if (!team) -return -EINVAL ; +if (!team) { + err = -EINVAL ; + goto rtnl_unlock; + } err =team_nl_send_port_list_get (team, info->snd_portid, info->snd_seq,NLM_F_ACK , team_nl_send_unicast,NULL );team_nl_team_put (team); +rtnl_unlock: +rtnl_unlock (); +return err; }
@@ -2961,11 +2955,9 @@ static void __team_port_change_port_removed(struct team_port *port)static void team_port_change_check (struct team_port *port,bool linkup) { -struct team *team = port->team; +ASSERT_RTNL (); -mutex_lock (&team->lock);__team_port_change_check (port, linkup); -mutex_unlock (&team->lock); }
drivers/net/team/team_mode_activebackup.c +1 -2
@@ -67,8 +67,7 @@ static void ab_active_port_get(struct team *team, struct team_gsetter_ctx *ctx) {struct team_port *active_port; - active_port =rcu_dereference_protected (ab_priv (team)->active_port, -lockdep_is_held (&team->lock)); + active_port =rtnl_dereference (ab_priv (team)->active_port);if (active_port) ctx->data.u32_val = active_port->dev->ifindex;else
drivers/net/team/team_mode_loadbalance.c +5 -8
@@ -301,8 +301,7 @@ static int lb_bpf_func_set(struct team *team, struct team_gsetter_ctx *ctx)if (lb_priv->ex->orig_fprog) {/* Clear old filter data */ __fprog_destroy (lb_priv->ex->orig_fprog); - orig_fp =rcu_dereference_protected (lb_priv->fp, -lockdep_is_held (&team->lock)); + orig_fp =rtnl_dereference (lb_priv->fp); }rcu_assign_pointer (lb_priv->fp, fp);
@@ -324,8 +323,7 @@ static void lb_bpf_func_free(struct team *team)return ;__fprog_destroy (lb_priv->ex->orig_fprog); - fp =rcu_dereference_protected (lb_priv->fp, -lockdep_is_held (&team->lock)); + fp =rtnl_dereference (lb_priv->fp);bpf_prog_destroy (fp); }
@@ -335,8 +333,7 @@ static void lb_tx_method_get(struct team *team, struct team_gsetter_ctx *ctx)lb_select_tx_port_func_t *func;char *name; - func =rcu_dereference_protected (lb_priv->select_tx_port_func, -lockdep_is_held (&team->lock)); + func =rtnl_dereference (lb_priv->select_tx_port_func); name =lb_select_tx_port_get_name (func);BUG_ON (!name); ctx->data.str_val = name;
@@ -478,7 +475,7 @@ static void lb_stats_refresh(struct work_struct *work) team = lb_priv_ex->team; lb_priv =get_lb_priv (team); -if (!mutex_trylock (&team->lock)) { +if (!rtnl_trylock ()) {schedule_delayed_work (&lb_priv_ex->stats.refresh_dw,0 );return ; }
@@ -515,7 +512,7 @@ static void lb_stats_refresh(struct work_struct *work)schedule_delayed_work (&lb_priv_ex->stats.refresh_dw, (lb_priv_ex->stats.refresh_interval *HZ ) /10 ); -mutex_unlock (&team->lock); +rtnl_unlock (); } static void lb_stats_refresh_interval_get(struct team *team,
include/linux/if_team.h +0 -3
@@ -191,8 +191,6 @@ struct team {const struct header_ops *header_ops_cache; -struct mutex lock;/* used for overall locking, e.g. port lists write */ -/* * List of enabled ports and their count */
@@ -223,7 +221,6 @@ struct team {atomic_t count_pending;struct delayed_work dw; } mcast_rejoin; -struct lock_class_key team_lock_key;long mode_priv[TEAM_MODE_PRIV_LONGS ]; };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 170/627 wifi: ath11k: clear initialized flag for deinit-ed srng lists
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
[ Upstream commit a5b46aa7cf5f05c213316a018e49a8e086efd98e ]
In a number of cases we see kernel panics on resume due to ath11k kernel page fault, which happens under the following circumstances:
1) First ath11k_hal_dump_srng_stats() call
Last interrupt received for each group:
ath11k_pci 0000:01:00.0: group_id 0 22511ms before
ath11k_pci 0000:01:00.0: group_id 1 14440788ms before
[..]
ath11k_pci 0000:01:00.0: failed to receive control response completion, polling.. ath11k_pci 0000:01:00.0: Service connect timeout
ath11k_pci 0000:01:00.0: failed to connect to HTT: -110
ath11k_pci 0000:01:00.0: failed to start core: -110
ath11k_pci 0000:01:00.0: firmware crashed: MHI_CB_EE_RDDM
ath11k_pci 0000:01:00.0: already resetting count 2
ath11k_pci 0000:01:00.0: failed to wait wlan mode request (mode 4): -110 ath11k_pci 0000:01:00.0: qmi failed to send wlan mode off: -110 ath11k_pci 0000:01:00.0: failed to reconfigure driver on crash recovery [..]
2) At this point reconfiguration fails (we have 2 resets) and ath11k_core_reconfigure_on_crash() calls ath11k_hal_srng_deinit() which destroys srng lists. However, it does not reset per-list ->initialized flag.
3) Second ath11k_hal_dump_srng_stats() call sees stale ->initialized flag and attempts to dump srng stats:
Last interrupt received for each group:
ath11k_pci 0000:01:00.0: group_id 0 66785ms before ath11k_pci 0000:01:00.0: group_id 1 14485062ms before ath11k_pci 0000:01:00.0: group_id 2 14485062ms before ath11k_pci 0000:01:00.0: group_id 3 14485062ms before ath11k_pci 0000:01:00.0: group_id 4 14780845ms before ath11k_pci 0000:01:00.0: group_id 5 14780845ms before ath11k_pci 0000:01:00.0: group_id 6 14485062ms before ath11k_pci 0000:01:00.0: group_id 7 66814ms before ath11k_pci 0000:01:00.0: group_id 8 68997ms before ath11k_pci 0000:01:00.0: group_id 9 67588ms before ath11k_pci 0000:01:00.0: group_id 10 69511ms before
BUG: unable to handle page fault for address: ffffa007404eb010 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page PGD 100000067 P4D 100000067 PUD 10022d067 PMD 100b01067 PTE 0 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:ath11k_hal_dump_srng_stats+0x2b4/0x3b0 [ath11k] Call Trace: <TASK> ? __die_body+0xae/0xb0 ? page_fault_oops+0x381/0x3e0 ? exc_page_fault+0x69/0xa0 ? asm_exc_page_fault+0x22/0x30 ? ath11k_hal_dump_srng_stats+0x2b4/0x3b0 [ath11k (HASH:6cea 4)] ath11k_qmi_driver_event_work+0xbd/0x1050 [ath11k (HASH:6cea 4)] worker_thread+0x389/0x930 kthread+0x149/0x170
Clear per-list ->initialized flag in ath11k_hal_srng_deinit().
--- drivers/net/wireless/ath/ath11k/hal.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ath11k/hal.c +4 -0
@@ -1346,6 +1346,10 @@ EXPORT_SYMBOL(ath11k_hal_srng_init);void ath11k_hal_srng_deinit (struct ath11k_base *ab) {struct ath11k_hal *hal = &ab->hal; +int i; + +for (i =0 ; i <HAL_SRNG_RING_ID_MAX ; i++) + ab->hal.srng_list[i].initialized =0 ;ath11k_hal_unregister_srng_key (ab);ath11k_hal_free_cont_rdp (ab);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 171/627 wifi: ath12k: Clear auth flag only for actual association in security mode
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thiraviyam Mariyappan <[email protected]>
[ Upstream commit c27bb624b3d789a337df3bbcc020a575680555cc ]
When setting a new bitrate, WMI peer association command is sent from the host without the peer authentication bit set in peer_flags for security mode, which causes ping failure.
The firmware handles peer_flags when the client is associating, as the peer authentication bit in peer_flags is set after the key exchange. When the WMI peer association command is sent from the host to update the new bitrate for an associated STA, the firmware expects the WMI peer authentication bit to be set in peer_flags.
Fix this issue by ensuring that the WMI peer auth bit is set in peer_flags in WMI peer association command when updating the new bitrate.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/mac.c | 4 ++++ drivers/net/wireless/ath/ath12k/wmi.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/mac.c +4 -0
@@ -3235,6 +3235,7 @@ static void ath12k_bss_assoc(struct ath12k *ar,rcu_read_unlock (); + peer_arg->is_assoc = true; ret =ath12k_wmi_send_peer_assoc_cmd (ar, peer_arg);if (ret) { ath12k_warn(ar->ab, "failed to run peer assoc for %pM vdev %i: %d\n",
@@ -5165,6 +5166,8 @@ static int ath12k_mac_station_assoc(struct ath12k *ar, "invalid peer NSS %d\n", peer_arg->peer_nss);return -EINVAL ; } + + peer_arg->is_assoc = true; ret =ath12k_wmi_send_peer_assoc_cmd (ar, peer_arg);if (ret) { ath12k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n",
@@ -5411,6 +5414,7 @@ static void ath12k_sta_rc_update_wk(struct wiphy *wiphy, struct wiphy_work *wk)ath12k_peer_assoc_prepare (ar, arvif, arsta, peer_arg, true); + peer_arg->is_assoc = false; err =ath12k_wmi_send_peer_assoc_cmd (ar, peer_arg);if (err) ath12k_warn(ar->ab, "failed to run peer assoc for STA %pM vdev %i: %d\n",
drivers/net/wireless/ath/ath12k/wmi.c +1 -1
@@ -2152,7 +2152,7 @@ static void ath12k_wmi_copy_peer_flags(struct wmi_peer_assoc_complete_cmd *cmd, cmd->peer_flags |=cpu_to_le32 (WMI_PEER_AUTH );if (arg->need_ptk_4_way) { cmd->peer_flags |=cpu_to_le32 (WMI_PEER_NEED_PTK_4_WAY ); -if (!hw_crypto_disabled) +if (!hw_crypto_disabled && arg->is_assoc) cmd->peer_flags &=cpu_to_le32 (~WMI_PEER_AUTH ); }if (arg->need_gtk_2_way)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 172/627 tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: xin.guo <[email protected]>
[ Upstream commit a041f70e573e185d5d5fdbba53f0db2fbe7257ad ]
If the new coming segment covers more than one skbs in the ofo queue, and which seq is equal to rcv_nxt, then the sequence range that is duplicated will be sent as DUP SACK, the detail as below, in step6, the {501,2001} range is clearly including too much DUP SACK range, in violation of RFC 2883 rules.
1. client > server: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500
2. server > client: Flags [.], ack 1, [nop,nop,sack 1 {501:1001}], length 0
3. client > server: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500
4. server > client: Flags [.], ack 1, [nop,nop,sack 2 {1501:2001} {501:1001}], length 0
5. client > server: Flags [.], seq 1:2001, ack 1325288529, win 20000, length 2000
6. server > client: Flags [.], ack 2001, [nop,nop,sack 1 {501:2001}], length 0
After this fix, the final ACK is as below:
6. server > client: Flags [.], ack 2001, options [nop,nop,sack 1 {501:1001}], length 0
[edumazet] added a new packetdrill test in the following patch.
--- net/ipv4/tcp_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/tcp_input.c +2 -1
@@ -4985,8 +4985,9 @@ static void tcp_ofo_queue(struct sock *sk)if (before (TCP_SKB_CB (skb)->seq, dsack_high)) {__u32 dsack = dsack_high; +if (before (TCP_SKB_CB (skb)->end_seq, dsack_high)) - dsack_high =TCP_SKB_CB (skb)->end_seq; + dsack =TCP_SKB_CB (skb)->end_seq;tcp_dsack_extend (sk,TCP_SKB_CB (skb)->seq, dsack); } p =rb_next (p);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 173/627 net/mlx5: Check device memory pointer before usage
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stav Aviram <[email protected]>
[ Upstream commit 70f238c902b8c0461ae6fbb8d1a0bbddc4350eea ]
Add a NULL check before accessing device memory to prevent a crash if dev->dm allocation in mlx5_init_once() fails.
--- drivers/infiniband/hw/mlx5/dm.c | 2 +- drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/main.c | 3 --- 3 files changed, 3 insertions(+), 6 deletions(-)
drivers/infiniband/hw/mlx5/dm.c +1 -1
@@ -282,7 +282,7 @@ static struct ib_dm *handle_alloc_dm_memic(struct ib_ucontext *ctx,int err;u64 address; -if (!MLX5_CAP_DEV_MEM (dm_db->dev, memic)) +if (!dm_db || !MLX5_CAP_DEV_MEM (dm_db->dev, memic))return ERR_PTR (-EOPNOTSUPP ); dm =kzalloc (sizeof (*dm),GFP_KERNEL );
drivers/net/ethernet/mellanox/mlx5/core/lib/dm.c +2 -2
@@ -30,7 +30,7 @@ struct mlx5_dm *mlx5_dm_create(struct mlx5_core_dev *dev) dm =kzalloc (sizeof (*dm),GFP_KERNEL );if (!dm) -return ERR_PTR (-ENOMEM ); +return NULL ;spin_lock_init (&dm->lock);
@@ -96,7 +96,7 @@ struct mlx5_dm *mlx5_dm_create(struct mlx5_core_dev *dev) err_steering:kfree (dm); -return ERR_PTR (-ENOMEM ); +return NULL ; }void mlx5_dm_cleanup (struct mlx5_core_dev *dev)
drivers/net/ethernet/mellanox/mlx5/core/main.c +0 -3
@@ -1102,9 +1102,6 @@ static int mlx5_init_once(struct mlx5_core_dev *dev) } dev->dm =mlx5_dm_create (dev); -if (IS_ERR (dev->dm)) -mlx5_core_warn (dev,"Failed to init device memory %ld\n" ,PTR_ERR (dev->dm)); - dev->tracer =mlx5_fw_tracer_create (dev); dev->hv_vhca =mlx5_hv_vhca_create (dev); dev->rsc_dump =mlx5_rsc_dump_create (dev);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 174/627 net: dst: annotate data-races around dst->input
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit f1c5fd34891a1c242885f48c2e4dc52df180f311 ]
dst_dev_put() can overwrite dst->input while other cpus might read this field (for instance from dst_input())
Add READ_ONCE()/WRITE_ONCE() annotations to suppress potential issues.
We will likely need full RCU protection later.
--- include/net/dst.h | 2 +- include/net/lwtunnel.h | 4 ++-- net/core/dst.c | 2 +- net/ipv4/route.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
include/net/dst.h +1 -1
@@ -466,7 +466,7 @@ INDIRECT_CALLABLE_DECLARE(int ip_local_deliver(struct sk_buff *));/* Input packet from network to transport. */ static inline int dst_input (struct sk_buff *skb) { -return INDIRECT_CALL_INET (skb_dst (skb)->input, +return INDIRECT_CALL_INET (READ_ONCE (skb_dst (skb)->input), ip6_input, ip_local_deliver, skb); }
include/net/lwtunnel.h +2 -2
@@ -142,8 +142,8 @@ static inline void lwtunnel_set_redirect(struct dst_entry *dst) dst->output = lwtunnel_output; }if (lwtunnel_input_redirect (dst->lwtstate)) { - dst->lwtstate->orig_input = dst->input; - dst->input = lwtunnel_input; + dst->lwtstate->orig_input =READ_ONCE (dst->input); +WRITE_ONCE (dst->input, lwtunnel_input); } }#else
net/core/dst.c +1 -1
@@ -148,7 +148,7 @@ void dst_dev_put(struct dst_entry *dst) dst->obsolete =DST_OBSOLETE_DEAD ;if (dst->ops->ifdown) dst->ops->ifdown (dst, dev); - dst->input = dst_discard; +WRITE_ONCE (dst->input, dst_discard); dst->output = dst_discard_out; dst->dev = blackhole_netdev; netdev_ref_replace(dev, blackhole_netdev, &dst->dev_tracker,
net/ipv4/route.c +1 -1
@@ -1685,7 +1685,7 @@ struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt)else if (rt->rt_gw_family ==AF_INET6 ) new_rt->rt_gw6 = rt->rt_gw6; - new_rt->dst.input = rt->dst.input; + new_rt->dst.input =READ_ONCE (rt->dst.input); new_rt->dst.output = rt->dst.output; new_rt->dst.error = rt->dst.error; new_rt->dst.lastuse = jiffies;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 175/627 net: dst: annotate data-races around dst->output
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 2dce8c52a98995c4719def6f88629ab1581c0b82 ]
dst_dev_put() can overwrite dst->output while other cpus might read this field (for instance from dst_output())
Add READ_ONCE()/WRITE_ONCE() annotations to suppress potential issues.
We will likely need RCU protection in the future.
--- include/net/dst.h | 2 +- include/net/lwtunnel.h | 4 ++-- net/core/dst.c | 2 +- net/ipv4/route.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
include/net/dst.h +1 -1
@@ -456,7 +456,7 @@ INDIRECT_CALLABLE_DECLARE(int ip_output(struct net *, struct sock *,/* Output packet to network from transport. */ static inline int dst_output (struct net *net,struct sock *sk,struct sk_buff *skb) { -return INDIRECT_CALL_INET (skb_dst (skb)->output, +return INDIRECT_CALL_INET (READ_ONCE (skb_dst (skb)->output), ip6_output, ip_output, net, sk, skb); }
include/net/lwtunnel.h +2 -2
@@ -138,8 +138,8 @@ int bpf_lwt_push_ip_encap(struct sk_buff *skb, void *hdr, u32 len,static inline void lwtunnel_set_redirect (struct dst_entry *dst) {if (lwtunnel_output_redirect (dst->lwtstate)) { - dst->lwtstate->orig_output = dst->output; - dst->output = lwtunnel_output; + dst->lwtstate->orig_output =READ_ONCE (dst->output); +WRITE_ONCE (dst->output, lwtunnel_output); }if (lwtunnel_input_redirect (dst->lwtstate)) { dst->lwtstate->orig_input =READ_ONCE (dst->input);
net/core/dst.c +1 -1
@@ -149,7 +149,7 @@ void dst_dev_put(struct dst_entry *dst)if (dst->ops->ifdown) dst->ops->ifdown (dst, dev);WRITE_ONCE (dst->input, dst_discard); - dst->output = dst_discard_out; +WRITE_ONCE (dst->output, dst_discard_out); dst->dev = blackhole_netdev;netdev_ref_replace (dev, blackhole_netdev, &dst->dev_tracker,GFP_ATOMIC );
net/ipv4/route.c +1 -1
@@ -1686,7 +1686,7 @@ struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt) new_rt->rt_gw6 = rt->rt_gw6; new_rt->dst.input =READ_ONCE (rt->dst.input); - new_rt->dst.output = rt->dst.output; + new_rt->dst.output =READ_ONCE (rt->dst.output); new_rt->dst.error = rt->dst.error; new_rt->dst.lastuse = jiffies; new_rt->dst.lwtstate =lwtstate_get (rt->dst.lwtstate);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 176/627 net: dst: add four helpers to annotate data-races around dst->dev
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 88fe14253e181878c2ddb51a298ae8c468a63010 ]
dst->dev is read locklessly in many contexts,
and written in dst_dev_put().
Fixing all the races is going to need many changes.
We probably will have to add full RCU protection.
Add three helpers to ease this painful process.
static inline struct net_device *dst_dev(const struct dst_entry *dst)
{
return READ_ONCE(dst->dev);
}static inline struct net_device *skb_dst_dev(const struct sk_buff *skb)
{
return dst_dev(skb_dst(skb));
}static inline struct net *skb_dst_dev_net(const struct sk_buff *skb)
{
return dev_net(skb_dst_dev(skb));
}static inline struct net *skb_dst_dev_net_rcu(const struct sk_buff *skb)
{
return dev_net_rcu(skb_dst_dev(skb));
}--- include/net/dst.h | 20 ++++++++++++++++++++ net/core/dst.c | 4 ++-- net/core/sock.c | 8 ++++---- 3 files changed, 26 insertions(+), 6 deletions(-)
include/net/dst.h +20 -0
@@ -561,6 +561,26 @@ static inline void skb_dst_update_pmtu_no_confirm(struct sk_buff *skb, u32 mtu) dst->ops->update_pmtu (dst,NULL , skb, mtu, false); } +static inline struct net_device *dst_dev (const struct dst_entry *dst) +{ +return READ_ONCE (dst->dev); +} + +static inline struct net_device *skb_dst_dev (const struct sk_buff *skb) +{ +return dst_dev (skb_dst (skb)); +} + +static inline struct net *skb_dst_dev_net (const struct sk_buff *skb) +{ +return dev_net (skb_dst_dev (skb)); +} + +static inline struct net *skb_dst_dev_net_rcu (const struct sk_buff *skb) +{ +return dev_net_rcu (skb_dst_dev (skb)); +} +struct dst_entry *dst_blackhole_check (struct dst_entry *dst,u32 cookie);void dst_blackhole_update_pmtu (struct dst_entry *dst,struct sock *sk,struct sk_buff *skb,u32 mtu,bool confirm_neigh);
net/core/dst.c +2 -2
@@ -150,7 +150,7 @@ void dst_dev_put(struct dst_entry *dst) dst->ops->ifdown (dst, dev);WRITE_ONCE (dst->input, dst_discard);WRITE_ONCE (dst->output, dst_discard_out); - dst->dev = blackhole_netdev; +WRITE_ONCE (dst->dev, blackhole_netdev);netdev_ref_replace (dev, blackhole_netdev, &dst->dev_tracker,GFP_ATOMIC ); }
@@ -263,7 +263,7 @@ unsigned int dst_blackhole_mtu(const struct dst_entry *dst) {unsigned int mtu =dst_metric_raw (dst,RTAX_MTU ); -return mtu ? : dst->dev->mtu; +return mtu ? :dst_dev (dst)->mtu; }EXPORT_SYMBOL_GPL (dst_blackhole_mtu);
net/core/sock.c +4 -4
@@ -2602,8 +2602,8 @@ static u32 sk_dst_gso_max_size(struct sock *sk, struct dst_entry *dst) !ipv6_addr_v4mapped(&sk->sk_v6_rcv_saddr));#endif /* pairs with the WRITE_ONCE() in netif_set_gso(_ipv4)_max_size() */ - max_size = is_ipv6 ?READ_ONCE (dst->dev->gso_max_size) : -READ_ONCE (dst->dev->gso_ipv4_max_size); + max_size = is_ipv6 ?READ_ONCE (dst_dev (dst)->gso_max_size) : +READ_ONCE (dst_dev (dst)->gso_ipv4_max_size);if (max_size >GSO_LEGACY_MAX_SIZE && !sk_is_tcp (sk)) max_size =GSO_LEGACY_MAX_SIZE ;
@@ -2614,7 +2614,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) {u32 max_segs =1 ; - sk->sk_route_caps = dst->dev->features; + sk->sk_route_caps =dst_dev (dst)->features;if (sk_is_tcp (sk)) {struct inet_connection_sock *icsk =inet_csk (sk);
@@ -2632,7 +2632,7 @@ void sk_setup_caps(struct sock *sk, struct dst_entry *dst) sk->sk_route_caps |=NETIF_F_SG |NETIF_F_HW_CSUM ; sk->sk_gso_max_size =sk_dst_gso_max_size (sk, dst);/* pairs with the WRITE_ONCE() in netif_set_gso_max_segs() */ - max_segs =max_t (u32,READ_ONCE (dst->dev->gso_max_segs),1 ); + max_segs =max_t (u32,READ_ONCE (dst_dev (dst)->gso_max_segs),1 ); } } sk->sk_gso_max_segs = max_segs;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 177/627 wifi: iwlwifi: Fix error code in iwl_op_mode_dvm_start()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit cf80c02a9fdb6c5bc8508beb6a0f6a1294fc32f6 ]
Preserve the error code if iwl_setup_deferred_work() fails. The current code returns ERR_PTR(0) (which is NULL) on this path. I believe the missing error code potentially leads to a use after free involving debugfs.
--- drivers/net/wireless/intel/iwlwifi/dvm/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/main.c +2 -1
@@ -1467,7 +1467,8 @@ static struct iwl_op_mode *iwl_op_mode_dvm_start(struct iwl_trans *trans,/******************** * 6. Setup services ********************/ -if (iwl_setup_deferred_work (priv)) + err =iwl_setup_deferred_work (priv); +if (err) goto out_uninit_drv;iwl_setup_rx_handlers (priv);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 178/627 kselftest/arm64: Fix check for setting new VLs in sve-ptrace
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
[ Upstream commit 867446f090589626497638f70b10be5e61a0b925 ]
The check that the new vector length we set was the expected one was typoed to an assignment statement which for some reason the compilers didn't spot, most likely due to the macros involved.
--- tools/testing/selftests/arm64/fp/sve-ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/arm64/fp/sve-ptrace.c +1 -1
@@ -253,7 +253,7 @@ static void ptrace_set_get_vl(pid_t child, const struct vec_type *type,return ; } -ksft_test_result (new_sve->vl = prctl_vl,"Set %s VL %u\n" , +ksft_test_result (new_sve->vl == prctl_vl,"Set %s VL %u\n" , type->name, vl);free (new_sve);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 179/627 wifi: mt76: mt7925: fix off by one in mt7925_mcu_hw_scan()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit b3a431fe2e399b2e0cc5f43f7e9d63d63d3710ee ]
The ssid->ssids[] and sreq->ssids[] arrays have MT7925_RNR_SCAN_MAX_BSSIDS elements so this >= needs to be > to prevent an out of bounds access.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +2 -2
@@ -2916,7 +2916,7 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,for (i =0 ; i < sreq->n_ssids; i++) {if (!sreq->ssids[i].ssid_len)continue ; -if (i >MT7925_RNR_SCAN_MAX_BSSIDS ) +if (i >=MT7925_RNR_SCAN_MAX_BSSIDS )break ; ssid->ssids[n_ssids].ssid_len =cpu_to_le32 (sreq->ssids[i].ssid_len);
@@ -2933,7 +2933,7 @@ int mt7925_mcu_hw_scan(struct mt76_phy *phy, struct ieee80211_vif *vif,mt76_connac_mcu_build_rnr_scan_param (mdev, sreq);for (j =0 ; j < mdev->rnr.bssid_num; j++) { -if (j >MT7925_RNR_SCAN_MAX_BSSIDS ) +if (j >=MT7925_RNR_SCAN_MAX_BSSIDS )break ; tlv = mt76_connac_mcu_add_tlv(skb, UNI_SCAN_BSSID,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 180/627 bpf: Ensure RCU lock is held around bpf_prog_ksym_find
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit d090326860096df9dac6f27cff76d3f8df44d4f1 ]
Add a warning to ensure RCU lock is held around tree lookup, and then fix one of the invocations in bpf_stack_walker. The program has an active stack frame and won't disappear. Use the opportunity to remove unneeded invocation of is_bpf_text_address.
--- kernel/bpf/core.c | 5 ++++- kernel/bpf/helpers.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-)
kernel/bpf/core.c +4 -1
@@ -778,7 +778,10 @@ bool is_bpf_text_address(unsigned long addr)struct bpf_prog *bpf_prog_ksym_find (unsigned long addr) { -struct bpf_ksym *ksym =bpf_ksym_find (addr); +struct bpf_ksym *ksym; + +WARN_ON_ONCE (!rcu_read_lock_held ()); + ksym =bpf_ksym_find (addr);return ksym && ksym->prog ? container_of(ksym, struct bpf_prog_aux, ksym)->prog :
kernel/bpf/helpers.c +9 -2
@@ -2943,9 +2943,16 @@ static bool bpf_stack_walker(void *cookie, u64 ip, u64 sp, u64 bp)struct bpf_throw_ctx *ctx = cookie;struct bpf_prog *prog; -if (!is_bpf_text_address (ip)) -return !ctx->cnt; +/* +* The RCU read lock is held to safely traverse the latch tree, but we +* don't need its protection when accessing the prog, since it has an +* active stack frame on the current stack trace, and won't disappear. +*/ +rcu_read_lock (); prog =bpf_prog_ksym_find (ip); +rcu_read_unlock (); +if (!prog) +return !ctx->cnt; ctx->cnt++;if (bpf_is_subprog (prog))return true;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 181/627 drm/msm/dpu: Fill in min_prefill_lines for SC8180X
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 5136acc40afc0261802e5cb01b04f871bf6d876b ]
Based on the downstream release, predictably same value as for SM8150.
Patchwork: https://patchwork.freedesktop.org/patch/657794/
--- drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h +1 -0
@@ -383,6 +383,7 @@ static const struct dpu_perf_cfg sc8180x_perf_data = { .min_core_ib = 2400000, .min_llcc_ib = 800000, .min_dram_ib = 800000, + .min_prefill_lines = 24, .danger_lut_tbl = {0xf, 0xffff, 0x0}, .safe_lut_tbl = {0xfff0, 0xf000, 0xffff}, .qos_lut_tbl = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 182/627 m68k: Dont unregister boot console needlessly
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 83f672a7f69ec38b1bbb27221e342937f68c11c7 ]
When MACH_IS_MVME147, the boot console calls mvme147_scc_write() to generate console output. That will continue to work even after debug_cons_nputs() becomes unavailable so there's no need to unregister the boot console.
Take the opportunity to remove a repeated MACH_IS_* test. Use the actual .write method (instead of a wrapper) and test that pointer instead. This means adding an unused parameter to debug_cons_nputs() for consistency with the struct console API.
early_printk.c is only built when CONFIG_EARLY_PRINTK=y. As of late, head.S is only built when CONFIG_MMU_MOTOROLA=y. So let the former symbol depend on the latter, to obviate some ifdef conditionals.
--- arch/m68k/Kconfig.debug | 2 +- arch/m68k/kernel/early_printk.c | 42 +++++++++++---------------------- arch/m68k/kernel/head.S | 8 +++---- 3 files changed, 19 insertions(+), 33 deletions(-)
arch/m68k/Kconfig.debug +1 -1
@@ -10,7 +10,7 @@ config BOOTPARAM_STRING config EARLY_PRINTK bool "Early printk" - depends on !(SUN3 || M68000 || COLDFIRE) + depends on MMU_MOTOROLA help Write kernel log output directly to a serial port. Where implemented, output goes to the framebuffer as well.
arch/m68k/kernel/early_printk.c +14 -28
65 lines not on this page · raw message
arch/m68k/kernel/head.S +4 -4
@@ -3263,8 +3263,8 @@ func_return putn * turns around and calls the internal routines. This routine * is used by the boot console. * - * The calling parameters are: - * void debug_cons_nputs(const char *str, unsigned length) + * The function signature is - + * void debug_cons_nputs(struct console *c, const char *s, unsigned int n) * * This routine does NOT understand variable arguments only * simple strings!
@@ -3273,8 +3273,8 @@ ENTRY(debug_cons_nputs) moveml %d0/%d1/%a0,%sp@- movew %sr,%sp@- ori #0x0700,%sr - movel %sp@(18),%a0 /* fetch parameter */ - movel %sp@(22),%d1 /* fetch parameter */ + movel %sp@(22),%a0 /* char *s */ + movel %sp@(26),%d1 /* unsigned int n */ jra 2f 1: #ifdef CONSOLE_DEBUG
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 183/627 refscale: Check that nreaders and loops multiplication doesnt overflow
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artem Sadovnikov <[email protected]>
[ Upstream commit 005b6187705bc9723518ce19c5cb911fc1f7ef07 ]
The nreaders and loops variables are exposed as module parameters, which, in certain combinations, can lead to multiplication overflow.
Besides, loops parameter is defined as long, while through the code is used as int, which can cause truncation on 64-bit kernels and possible zeroes where they shouldn't appear.
Since code uses result of multiplication as int anyway, it only makes sense to replace loops with int. Multiplication overflow check is also added due to possible multiplication between two very big numbers.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- kernel/rcu/refscale.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
kernel/rcu/refscale.c +7 -3
@@ -85,7 +85,7 @@ torture_param(int, holdoff, IS_BUILTIN(CONFIG_RCU_REF_SCALE_TEST) ? 10 : 0,// Number of typesafe_lookup structures, that is, the degree of concurrency. torture_param (long, lookup_instances,0 ,"Number of typesafe_lookup structures." );// Number of loops per experiment, all readers execute operations concurrently. -torture_param (long, loops,10000 ,"Number of loops per experiment." ); +torture_param (int, loops,10000 ,"Number of loops per experiment." );// Number of readers, with -1 defaulting to about 75% of the CPUs. torture_param (int, nreaders,-1 ,"Number of readers, -1 for 75% of CPUs." );// Number of runs.
@@ -1140,7 +1140,7 @@ static void ref_scale_print_module_parms(const struct ref_scale_ops *cur_ops, const char *tag) { pr_alert("%s" SCALE_FLAG -"--- %s: verbose=%d verbose_batched=%d shutdown=%d holdoff=%d lookup_instances=%ld loops=%ld nreaders=%d nruns=%d readdelay=%d\n" , scale_type, tag, +"--- %s: verbose=%d verbose_batched=%d shutdown=%d holdoff=%d lookup_instances=%ld loops=%d nreaders=%d nruns=%d readdelay=%d\n" , scale_type, tag, verbose, verbose_batched, shutdown, holdoff, lookup_instances, loops, nreaders, nruns, readdelay); }
@@ -1238,12 +1238,16 @@ ref_scale_init(void)// Reader tasks (default to ~75% of online CPUs). if (nreaders <0 ) nreaders = (num_online_cpus () >>1 ) + (num_online_cpus () >>2 ); -if (WARN_ONCE (loops <=0 ,"%s: loops = %ld, adjusted to 1\n" , __func__, loops)) +if (WARN_ONCE (loops <=0 ,"%s: loops = %d, adjusted to 1\n" , __func__, loops)) loops =1 ;if (WARN_ONCE (nreaders <=0 ,"%s: nreaders = %d, adjusted to 1\n" , __func__, nreaders)) nreaders =1 ;if (WARN_ONCE (nruns <=0 ,"%s: nruns = %d, adjusted to 1\n" , __func__, nruns)) nruns =1 ; +if (WARN_ONCE (loops >INT_MAX / nreaders, +"%s: nreaders * loops will overflow, adjusted loops to %d" , + __func__,INT_MAX / nreaders)) + loops =INT_MAX / nreaders; reader_tasks =kcalloc (nreaders,sizeof (reader_tasks[0 ]),GFP_KERNEL );if (!reader_tasks) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 184/627 wifi: mt76: mt7996: Fix secondary link lookup in mt7996_mcu_sta_mld_setup_tlv()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit e8d7eef07199887161cd6f3c062406628781f8b6 ]
Use proper link_id value for secondary link lookup in mt7996_mcu_sta_mld_setup_tlv routine.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +1 -2
@@ -2326,8 +2326,7 @@ mt7996_mcu_sta_mld_setup_tlv(struct mt7996_dev *dev, struct sk_buff *skb,if (nlinks >1 ) { link_id =__ffs (links & ~BIT (msta->deflink_id)); - msta_link =mt76_dereference (msta->link[msta->deflink_id], - &dev->mt76); + msta_link =mt76_dereference (msta->link[link_id], &dev->mt76);if (!msta_link)return ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 185/627 wifi: mt76: mt7996: Fix possible OOB access in mt7996_tx()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit 64cbf0d7ce9afe20666da90ec6ecaec6ba5ac64b ]
Fis possible Out-Of-Boundary access in mt7996_tx routine if link_id is set to IEEE80211_LINK_UNSPECIFIED
--- .../net/wireless/mediatek/mt76/mt7996/main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +12 -5
@@ -1216,10 +1216,17 @@ static void mt7996_tx(struct ieee80211_hw *hw,if (vif) {struct mt7996_vif *mvif = (void *)vif->drv_priv; -struct mt76_vif_link *mlink; +struct mt76_vif_link *mlink = &mvif->deflink.mt76; - mlink =rcu_dereference (mvif->mt76.link[link_id]); -if (mlink && mlink->wcid) +if (link_id <IEEE80211_LINK_UNSPECIFIED ) + mlink =rcu_dereference (mvif->mt76.link[link_id]); + +if (!mlink) { +ieee80211_free_txskb (hw, skb); + goto unlock; + } + +if (mlink->wcid) wcid = mlink->wcid; if (mvif->mt76.roc_phy &&
@@ -1228,7 +1235,7 @@ static void mt7996_tx(struct ieee80211_hw *hw,if (mphy->roc_link) wcid = mphy->roc_link->wcid; }else { - mphy =mt76_vif_link_phy (&mvif->deflink.mt76); + mphy =mt76_vif_link_phy (mlink); } }
@@ -1237,7 +1244,7 @@ static void mt7996_tx(struct ieee80211_hw *hw, goto unlock; } -if (control->sta) { +if (control->sta && link_id <IEEE80211_LINK_UNSPECIFIED ) {struct mt7996_sta *msta = (void *)control->sta->drv_priv;struct mt7996_sta_link *msta_link;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 186/627 wifi: mt76: mt7996: Fix valid_links bitmask in mt7996_mac_sta_{add,remove}
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit a59650a2270190905fdab79431140371feb35251 ]
sta->valid_links bitmask can be set even for non-MLO client.
--- drivers/net/wireless/mediatek/mt76/mt7996/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +2 -2
@@ -1061,7 +1061,7 @@ mt7996_mac_sta_add(struct mt76_phy *mphy, struct ieee80211_vif *vif, struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76);struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; -unsigned long links = sta->mlo ? sta->valid_links :BIT (0 ); +unsigned long links = sta->valid_links ? sta->valid_links :BIT (0 );int err;mutex_lock (&mdev->mutex);
@@ -1155,7 +1155,7 @@ mt7996_mac_sta_remove(struct mt76_phy *mphy, struct ieee80211_vif *vif, {struct mt76_dev *mdev = mphy->dev; struct mt7996_dev *dev = container_of(mdev, struct mt7996_dev, mt76); -unsigned long links = sta->mlo ? sta->valid_links :BIT (0 ); +unsigned long links = sta->valid_links ? sta->valid_links :BIT (0 );mutex_lock (&mdev->mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 187/627 drm/amdkfd: Move the process suspend and resume out of full access
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Emily Deng <[email protected]>
[ Upstream commit 54f7a24e1437d66c9ff36d727a9dff1beeeab429 ]
For the suspend and resume process, exclusive access is not required. Therefore, it can be moved out of the full access section to reduce the duration of exclusive access.
v3:
Move suspend processes before hardware fini.
Remove twice call for bare metal.
v4:
Refine code
Stable-dep-of: 14b2d71a9a24 ("drm/amdgpu/gfx10: fix KGQ reset sequence")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 24 +++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 25 ++++++--- .../drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 11 ++-- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 4 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 54 ++++++++++++------- 6 files changed, 86 insertions(+), 36 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +20 -4
@@ -248,18 +248,34 @@ void amdgpu_amdkfd_interrupt(struct amdgpu_device *adev,kgd2kfd_interrupt (adev->kfd.dev, ih_ring_entry); } -void amdgpu_amdkfd_suspend (struct amdgpu_device *adev,bool run_pm) +void amdgpu_amdkfd_suspend (struct amdgpu_device *adev,bool suspend_proc) {if (adev->kfd.dev) -kgd2kfd_suspend (adev->kfd.dev, run_pm); +kgd2kfd_suspend (adev->kfd.dev, suspend_proc); } -int amdgpu_amdkfd_resume (struct amdgpu_device *adev,bool run_pm) +int amdgpu_amdkfd_resume (struct amdgpu_device *adev,bool resume_proc) {int r =0 ;if (adev->kfd.dev) - r =kgd2kfd_resume (adev->kfd.dev, run_pm); + r =kgd2kfd_resume (adev->kfd.dev, resume_proc); + +return r; +} + +void amdgpu_amdkfd_suspend_process (struct amdgpu_device *adev) +{ +if (adev->kfd.dev) +kgd2kfd_suspend_process (adev->kfd.dev); +} + +int amdgpu_amdkfd_resume_process (struct amdgpu_device *adev) +{ +int r =0 ; + +if (adev->kfd.dev) + r =kgd2kfd_resume_process (adev->kfd.dev);return r; }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +19 -6
@@ -154,8 +154,10 @@ struct amdkfd_process_info {int amdgpu_amdkfd_init (void );void amdgpu_amdkfd_fini (void ); -void amdgpu_amdkfd_suspend (struct amdgpu_device *adev,bool run_pm); -int amdgpu_amdkfd_resume (struct amdgpu_device *adev,bool run_pm); +void amdgpu_amdkfd_suspend (struct amdgpu_device *adev,bool suspend_proc); +int amdgpu_amdkfd_resume (struct amdgpu_device *adev,bool resume_proc); +void amdgpu_amdkfd_suspend_process (struct amdgpu_device *adev); +int amdgpu_amdkfd_resume_process (struct amdgpu_device *adev);void amdgpu_amdkfd_interrupt (struct amdgpu_device *adev,const void *ih_ring_entry);void amdgpu_amdkfd_device_probe (struct amdgpu_device *adev);
@@ -411,8 +413,10 @@ struct kfd_dev *kgd2kfd_probe(struct amdgpu_device *adev, bool vf);bool kgd2kfd_device_init (struct kfd_dev *kfd,const struct kgd2kfd_shared_resources *gpu_resources);void kgd2kfd_device_exit (struct kfd_dev *kfd); -void kgd2kfd_suspend (struct kfd_dev *kfd,bool run_pm); -int kgd2kfd_resume (struct kfd_dev *kfd,bool run_pm); +void kgd2kfd_suspend (struct kfd_dev *kfd,bool suspend_proc); +int kgd2kfd_resume (struct kfd_dev *kfd,bool resume_proc); +void kgd2kfd_suspend_process (struct kfd_dev *kfd); +int kgd2kfd_resume_process (struct kfd_dev *kfd);int kgd2kfd_pre_reset (struct kfd_dev *kfd,struct amdgpu_reset_context *reset_context);int kgd2kfd_post_reset (struct kfd_dev *kfd);
@@ -454,11 +458,20 @@ static inline void kgd2kfd_device_exit(struct kfd_dev *kfd) { } -static inline void kgd2kfd_suspend (struct kfd_dev *kfd,bool run_pm) +static inline void kgd2kfd_suspend (struct kfd_dev *kfd,bool suspend_proc) { } -static inline int kgd2kfd_resume (struct kfd_dev *kfd,bool run_pm) +static inline int kgd2kfd_resume (struct kfd_dev *kfd,bool resume_proc) +{ +return 0 ; +} + +static inline void kgd2kfd_suspend_process (struct kfd_dev *kfd) +{ +} + +static inline int kgd2kfd_resume_process (struct kfd_dev *kfd) {return 0 ; }
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_arcturus.c +2 -2
@@ -320,7 +320,7 @@ static void set_barrier_auto_waitcnt(struct amdgpu_device *adev, bool enable_waiif (!down_read_trylock (&adev->reset_domain->sem))return ; -amdgpu_amdkfd_suspend (adev, false); +amdgpu_amdkfd_suspend (adev, true);if (suspend_resume_compute_scheduler (adev, true)) goto out;
@@ -333,7 +333,7 @@ static void set_barrier_auto_waitcnt(struct amdgpu_device *adev, bool enable_wai out:suspend_resume_compute_scheduler (adev, false); -amdgpu_amdkfd_resume (adev, false); +amdgpu_amdkfd_resume (adev, true);up_read (&adev->reset_domain->sem); }
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -3
@@ -3518,7 +3518,7 @@ static int amdgpu_device_ip_fini_early(struct amdgpu_device *adev)amdgpu_device_set_pg_state (adev,AMD_PG_STATE_UNGATE );amdgpu_device_set_cg_state (adev,AMD_CG_STATE_UNGATE ); -amdgpu_amdkfd_suspend (adev, false); +amdgpu_amdkfd_suspend (adev, true);amdgpu_userq_suspend (adev);/* Workaround for ASICs need to disable SMC first */
@@ -5055,6 +5055,8 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients) adev->in_suspend = true;if (amdgpu_sriov_vf (adev)) { +if (!adev->in_s0ix && !adev->in_runpm) +amdgpu_amdkfd_suspend_process (adev);amdgpu_virt_fini_data_exchange (adev); r =amdgpu_virt_request_full_gpu (adev, false);if (r)
@@ -5074,7 +5076,7 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)amdgpu_device_ip_suspend_phase1 (adev);if (!adev->in_s0ix) { -amdgpu_amdkfd_suspend (adev, adev->in_runpm); +amdgpu_amdkfd_suspend (adev, !amdgpu_sriov_vf (adev) && !adev->in_runpm);amdgpu_userq_suspend (adev); }
@@ -5140,7 +5142,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients) }if (!adev->in_s0ix) { - r =amdgpu_amdkfd_resume (adev, adev->in_runpm); + r =amdgpu_amdkfd_resume (adev, !amdgpu_sriov_vf (adev) && !adev->in_runpm);if (r) goto exit;
@@ -5159,6 +5161,9 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)if (amdgpu_sriov_vf (adev)) {amdgpu_virt_init_data_exchange (adev);amdgpu_virt_release_full_gpu (adev, true); + +if (!adev->in_s0ix && !r && !adev->in_runpm) + r =amdgpu_amdkfd_resume_process (adev); }if (r)
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +2 -2
@@ -1681,9 +1681,9 @@ static int sdma_v4_4_2_reset_queue(struct amdgpu_ring *ring, unsigned int vmid)if (!(adev->sdma.supported_reset &AMDGPU_RESET_TYPE_PER_QUEUE ))return -EOPNOTSUPP ; -amdgpu_amdkfd_suspend (adev, false); +amdgpu_amdkfd_suspend (adev, true); r =amdgpu_sdma_reset_engine (adev, id); -amdgpu_amdkfd_resume (adev, false); +amdgpu_amdkfd_resume (adev, true);return r; }
drivers/gpu/drm/amd/amdkfd/kfd_device.c +35 -19
84 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 188/627 drm/amdgpu: rework queue reset scheduler interaction
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
[ Upstream commit 821aacb2dcf0d1fbc3c0f7803b6089b01addb8bf ]
Stopping the scheduler for queue reset is generally a good idea because it prevents any worker from touching the ring buffer.
Stable-dep-of: 14b2d71a9a24 ("drm/amdgpu/gfx10: fix KGQ reset sequence")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 35 ++++++++++++++----------- 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +20 -15
@@ -91,8 +91,8 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)struct amdgpu_job *job =to_amdgpu_job (s_job);struct amdgpu_task_info *ti;struct amdgpu_device *adev = ring->adev; -int idx; -int r; +bool set_error = false; +int idx, r;if (!drm_dev_enter (adev_to_drm (adev), &idx)) { dev_info(adev->dev, "%s - device unplugged skipping recovery on scheduler:%s",
@@ -136,10 +136,12 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) }else if (amdgpu_gpu_recovery && ring->funcs->reset) {bool is_guilty; -dev_err (adev->dev,"Starting %s ring reset\n" , s_job->sched->name); -/* stop the scheduler, but don't mess with the -* bad job yet because if ring reset fails -* we'll fall back to full GPU reset. +dev_err (adev->dev,"Starting %s ring reset\n" , + s_job->sched->name); + +/* +* Stop the scheduler to prevent anybody else from touching the +* ring buffer. */ drm_sched_wqueue_stop (&ring->sched);
@@ -152,26 +154,29 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job)else is_guilty = true; -if (is_guilty) +if (is_guilty) {dma_fence_set_error (&s_job->s_fence->finished, -ETIME ); + set_error = true; + } r =amdgpu_ring_reset (ring, job->vmid);if (!r) { -if (amdgpu_ring_sched_ready (ring)) -drm_sched_stop (&ring->sched, s_job);if (is_guilty) {atomic_inc (&ring->adev->gpu_reset_counter);amdgpu_fence_driver_force_completion (ring); } -if (amdgpu_ring_sched_ready (ring)) -drm_sched_start (&ring->sched,0 ); -dev_err (adev->dev,"Ring %s reset succeeded\n" , ring->sched.name); -drm_dev_wedged_event (adev_to_drm (adev),DRM_WEDGE_RECOVERY_NONE ); +drm_sched_wqueue_start (&ring->sched); +dev_err (adev->dev,"Ring %s reset succeeded\n" , + ring->sched.name); +drm_dev_wedged_event (adev_to_drm (adev), +DRM_WEDGE_RECOVERY_NONE ); goto exit; } -dev_err (adev->dev,"Ring %s reset failure\n" , ring->sched.name); +dev_err (adev->dev,"Ring %s reset failed\n" , ring->sched.name); } -dma_fence_set_error (&s_job->s_fence->finished, -ETIME ); + +if (!set_error) +dma_fence_set_error (&s_job->s_fence->finished, -ETIME );if (amdgpu_device_should_recover_gpu (ring->adev)) {struct amdgpu_reset_context reset_context;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 189/627 drm/amdgpu: move force completion into ring resets
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 2dee58ca471dae05c473270d0fb74efe01a78ccb ]
Move the force completion handling into each ring reset function so that each engine can determine whether or not it needs to force completion on the jobs in the ring.
Stable-dep-of: 14b2d71a9a24 ("drm/amdgpu/gfx10: fix KGQ reset sequence")
--- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 4 +-- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 12 +++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 12 +++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 12 +++++++-- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 7 +++++- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 7 +++++- drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c | 8 +++++- drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c | 8 +++++- drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c | 8 +++++- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c | 8 +++++- drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c | 8 +++++- drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c | 8 +++++- drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c | 31 +++++++++++++++++++++--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 5 +++- drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 5 +++- drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c | 6 ++++- drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 6 ++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c | 7 +++++- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 6 +++-- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c | 7 +++++- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c | 7 +++++- 21 files changed, 152 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +1 -3
@@ -161,10 +161,8 @@ static enum drm_gpu_sched_stat amdgpu_job_timedout(struct drm_sched_job *s_job) r =amdgpu_ring_reset (ring, job->vmid);if (!r) { -if (is_guilty) { +if (is_guilty)atomic_inc (&ring->adev->gpu_reset_counter); -amdgpu_fence_driver_force_completion (ring); - }drm_sched_wqueue_start (&ring->sched);dev_err (adev->dev,"Ring %s reset succeeded\n" , ring->sched.name);
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +10 -2
@@ -9575,7 +9575,11 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return r; } -return amdgpu_ring_test_ring (ring); + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; } static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring,
@@ -9647,7 +9651,11 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring,if (r)return r; -return amdgpu_ring_test_ring (ring); + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static void gfx_v10_ip_print (struct amdgpu_ip_block *ip_block,struct drm_printer *p)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +10 -2
@@ -6840,7 +6840,11 @@ static int gfx_v11_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return r; } -return amdgpu_ring_test_ring (ring); + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static int gfx_v11_0_reset_compute_pipe (struct amdgpu_ring *ring)
@@ -7000,7 +7004,11 @@ static int gfx_v11_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)return r; } -return amdgpu_ring_test_ring (ring); + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static void gfx_v11_ip_print (struct amdgpu_ip_block *ip_block,struct drm_printer *p)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +10 -2
@@ -5335,7 +5335,11 @@ static int gfx_v12_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return r; } -return amdgpu_ring_test_ring (ring); + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static int gfx_v12_0_reset_compute_pipe (struct amdgpu_ring *ring)
@@ -5448,7 +5452,11 @@ static int gfx_v12_0_reset_kcq(struct amdgpu_ring *ring, unsigned int vmid)return r; } -return amdgpu_ring_test_ring (ring); + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static void gfx_v12_0_ring_begin_use (struct amdgpu_ring *ring)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -1
@@ -7286,7 +7286,12 @@ static int gfx_v9_0_reset_kcq(struct amdgpu_ring *ring,DRM_ERROR ("fail to remap queue\n" );return r; } -return amdgpu_ring_test_ring (ring); + + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static void gfx_v9_ip_print (struct amdgpu_ip_block *ip_block,struct drm_printer *p)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +6 -1
@@ -3619,7 +3619,12 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring,dev_err (adev->dev,"fail to remap queue\n" );return r; } -return amdgpu_ring_test_ring (ring); + + r =amdgpu_ring_test_ring (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }enum amdgpu_gfx_cp_ras_mem_id {
drivers/gpu/drm/amd/amdgpu/jpeg_v2_0.c +7 -1
@@ -766,9 +766,15 @@ static int jpeg_v2_0_process_interrupt(struct amdgpu_device *adev,static int jpeg_v2_0_ring_reset (struct amdgpu_ring *ring,unsigned int vmid) { +int r; +jpeg_v2_0_stop (ring->adev);jpeg_v2_0_start (ring->adev); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amd_ip_funcs jpeg_v2_0_ip_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v2_5.c +7 -1
@@ -645,9 +645,15 @@ static int jpeg_v2_5_process_interrupt(struct amdgpu_device *adev,static int jpeg_v2_5_ring_reset (struct amdgpu_ring *ring,unsigned int vmid) { +int r; +jpeg_v2_5_stop_inst (ring->adev, ring->me);jpeg_v2_5_start_inst (ring->adev, ring->me); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amd_ip_funcs jpeg_v2_5_ip_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v3_0.c +7 -1
@@ -557,9 +557,15 @@ static int jpeg_v3_0_process_interrupt(struct amdgpu_device *adev,static int jpeg_v3_0_ring_reset (struct amdgpu_ring *ring,unsigned int vmid) { +int r; +jpeg_v3_0_stop (ring->adev);jpeg_v3_0_start (ring->adev); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amd_ip_funcs jpeg_v3_0_ip_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0.c +7 -1
@@ -722,12 +722,18 @@ static int jpeg_v4_0_process_interrupt(struct amdgpu_device *adev,static int jpeg_v4_0_ring_reset (struct amdgpu_ring *ring,unsigned int vmid) { +int r; +if (amdgpu_sriov_vf (ring->adev))return -EINVAL ;jpeg_v4_0_stop (ring->adev);jpeg_v4_0_start (ring->adev); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amd_ip_funcs jpeg_v4_0_ip_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v4_0_3.c +7 -1
@@ -1145,12 +1145,18 @@ static void jpeg_v4_0_3_core_stall_reset(struct amdgpu_ring *ring)static int jpeg_v4_0_3_ring_reset (struct amdgpu_ring *ring,unsigned int vmid) { +int r; +if (amdgpu_sriov_vf (ring->adev))return -EOPNOTSUPP ;jpeg_v4_0_3_core_stall_reset (ring);jpeg_v4_0_3_start_jrbc (ring); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amd_ip_funcs jpeg_v4_0_3_ip_funcs = {
drivers/gpu/drm/amd/amdgpu/jpeg_v5_0_1.c +7 -1
@@ -836,12 +836,18 @@ static void jpeg_v5_0_1_core_stall_reset(struct amdgpu_ring *ring)static int jpeg_v5_0_1_ring_reset (struct amdgpu_ring *ring,unsigned int vmid) { +int r; +if (amdgpu_sriov_vf (ring->adev))return -EOPNOTSUPP ;jpeg_v5_0_1_core_stall_reset (ring);jpeg_v5_0_1_init_jrbc (ring); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amd_ip_funcs jpeg_v5_0_1_ip_funcs = {
drivers/gpu/drm/amd/amdgpu/sdma_v4_4_2.c +27 -4
@@ -1674,6 +1674,7 @@ static bool sdma_v4_4_2_page_ring_is_guilty(struct amdgpu_ring *ring)static int sdma_v4_4_2_reset_queue (struct amdgpu_ring *ring,unsigned int vmid) { +bool is_guilty = ring->funcs->is_guilty (ring);struct amdgpu_device *adev = ring->adev;u32 id = ring->me;int r;
@@ -1684,8 +1685,13 @@ static int sdma_v4_4_2_reset_queue(struct amdgpu_ring *ring, unsigned int vmid)amdgpu_amdkfd_suspend (adev, true); r =amdgpu_sdma_reset_engine (adev, id);amdgpu_amdkfd_resume (adev, true); +if (r) +return r; -return r; +if (is_guilty) +amdgpu_fence_driver_force_completion (ring); + +return 0 ; }static int sdma_v4_4_2_stop_queue (struct amdgpu_ring *ring)
@@ -1729,8 +1735,8 @@ static int sdma_v4_4_2_stop_queue(struct amdgpu_ring *ring)static int sdma_v4_4_2_restore_queue (struct amdgpu_ring *ring) {struct amdgpu_device *adev = ring->adev; -u32 inst_mask; -int i; +u32 inst_mask, tmp_mask; +int i, r; inst_mask =1 << ring->me;udelay (50 );
@@ -1747,7 +1753,24 @@ static int sdma_v4_4_2_restore_queue(struct amdgpu_ring *ring)return -ETIMEDOUT ; } -return sdma_v4_4_2_inst_start (adev, inst_mask, true); + r =sdma_v4_4_2_inst_start (adev, inst_mask, true); +if (r) +return r; + + tmp_mask = inst_mask; +for_each_inst (i, tmp_mask) { + ring = &adev->sdma.instance[i].ring; + +amdgpu_fence_driver_force_completion (ring); + +if (adev->sdma.has_page_queue) { +struct amdgpu_ring *page = &adev->sdma.instance[i].page; + +amdgpu_fence_driver_force_completion (page); + } + } + +return r; } static int sdma_v4_4_2_set_trap_irq_state(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +4 -1
@@ -1616,7 +1616,10 @@ static int sdma_v5_0_restore_queue(struct amdgpu_ring *ring) r =sdma_v5_0_gfx_resume_instance (adev, inst_id, true);amdgpu_gfx_rlc_exit_safe_mode (adev,0 ); -return r; +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static int sdma_v5_0_ring_preempt_ib (struct amdgpu_ring *ring)
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c +4 -1
@@ -1532,7 +1532,10 @@ static int sdma_v5_2_restore_queue(struct amdgpu_ring *ring) r =sdma_v5_2_gfx_resume_instance (adev, inst_id, true);amdgpu_gfx_rlc_exit_safe_mode (adev,0 ); -return r; +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static int sdma_v5_2_ring_preempt_ib (struct amdgpu_ring *ring)
drivers/gpu/drm/amd/amdgpu/sdma_v6_0.c +5 -1
@@ -1572,7 +1572,11 @@ static int sdma_v6_0_reset_queue(struct amdgpu_ring *ring, unsigned int vmid)if (r)return r; -return sdma_v6_0_gfx_resume_instance (adev, i, true); + r =sdma_v6_0_gfx_resume_instance (adev, i, true); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; } static int sdma_v6_0_set_trap_irq_state(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +5 -1
@@ -824,7 +824,11 @@ static int sdma_v7_0_reset_queue(struct amdgpu_ring *ring, unsigned int vmid)if (r)return r; -return sdma_v7_0_gfx_resume_instance (adev, i, true); + r =sdma_v7_0_gfx_resume_instance (adev, i, true); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }/**
drivers/gpu/drm/amd/amdgpu/vcn_v4_0.c +6 -1
@@ -1971,6 +1971,7 @@ static int vcn_v4_0_ring_reset(struct amdgpu_ring *ring, unsigned int vmid) {struct amdgpu_device *adev = ring->adev;struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me]; +int r;if (!(adev->vcn.supported_reset &AMDGPU_RESET_TYPE_PER_QUEUE ))return -EOPNOTSUPP ;
@@ -1978,7 +1979,11 @@ static int vcn_v4_0_ring_reset(struct amdgpu_ring *ring, unsigned int vmid)vcn_v4_0_stop (vinst);vcn_v4_0_start (vinst); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static struct amdgpu_ring_funcs vcn_v4_0_unified_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +4 -2
@@ -1621,8 +1621,10 @@ static int vcn_v4_0_3_ring_reset(struct amdgpu_ring *ring, unsigned int vmid)vcn_v4_0_3_hw_init_inst (vinst);vcn_v4_0_3_start_dpg_mode (vinst, adev->vcn.inst[ring->me].indirect_sram); r =amdgpu_ring_test_helper (ring); - -return r; +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amdgpu_ring_funcs vcn_v4_0_3_unified_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/vcn_v4_0_5.c +6 -1
@@ -1469,6 +1469,7 @@ static int vcn_v4_0_5_ring_reset(struct amdgpu_ring *ring, unsigned int vmid) {struct amdgpu_device *adev = ring->adev;struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me]; +int r;if (!(adev->vcn.supported_reset &AMDGPU_RESET_TYPE_PER_QUEUE ))return -EOPNOTSUPP ;
@@ -1476,7 +1477,11 @@ static int vcn_v4_0_5_ring_reset(struct amdgpu_ring *ring, unsigned int vmid)vcn_v4_0_5_stop (vinst);vcn_v4_0_5_start (vinst); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static struct amdgpu_ring_funcs vcn_v4_0_5_unified_ring_vm_funcs = {
drivers/gpu/drm/amd/amdgpu/vcn_v5_0_0.c +6 -1
@@ -1196,6 +1196,7 @@ static int vcn_v5_0_0_ring_reset(struct amdgpu_ring *ring, unsigned int vmid) {struct amdgpu_device *adev = ring->adev;struct amdgpu_vcn_inst *vinst = &adev->vcn.inst[ring->me]; +int r;if (!(adev->vcn.supported_reset &AMDGPU_RESET_TYPE_PER_QUEUE ))return -EOPNOTSUPP ;
@@ -1203,7 +1204,11 @@ static int vcn_v5_0_0_ring_reset(struct amdgpu_ring *ring, unsigned int vmid)vcn_v5_0_0_stop (vinst);vcn_v5_0_0_start (vinst); -return amdgpu_ring_test_helper (ring); + r =amdgpu_ring_test_helper (ring); +if (r) +return r; +amdgpu_fence_driver_force_completion (ring); +return 0 ; }static const struct amdgpu_ring_funcs vcn_v5_0_0_unified_ring_vm_funcs = {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 190/627 drm/amdgpu/gfx10: fix KGQ reset sequence
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 14b2d71a9a24727f1b9f2131ed5eb2e345840a3a ]
Need to reinit the ring before remapping it and all of the KIQ handling needs to be within the kiq lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +15 -5
@@ -9540,7 +9540,7 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)spin_lock_irqsave (&kiq->ring_lock, flags); -if (amdgpu_ring_alloc (kiq_ring,5 +7 +7 + kiq->pmf->map_queues_size)) { +if (amdgpu_ring_alloc (kiq_ring,5 +7 +7 )) {spin_unlock_irqrestore (&kiq->ring_lock, flags);return -ENOMEM ; }
@@ -9560,12 +9560,9 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid) 0, 1, 0x20);gfx_v10_0_ring_emit_reg_wait (kiq_ring,SOC15_REG_OFFSET (GC ,0 , mmCP_VMID_RESET),0 ,0xffffffff ); - kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); - -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r)return r;
@@ -9575,6 +9572,19 @@ static int gfx_v10_0_reset_kgq(struct amdgpu_ring *ring, unsigned int vmid)return r; } +spin_lock_irqsave (&kiq->ring_lock, flags); + +if (amdgpu_ring_alloc (kiq_ring, kiq->pmf->map_queues_size)) { +spin_unlock_irqrestore (&kiq->ring_lock, flags); +return -ENOMEM ; + } + kiq->pmf->kiq_map_queues (kiq_ring, ring); +amdgpu_ring_commit (kiq_ring); + r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags); +if (r) +return r; + r =amdgpu_ring_test_ring (ring);if (r)return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 191/627 drm/amd/pm/powerplay/hwmgr/smu_helper: fix order of mask and value
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit a54e4639c4ef37a0241bac7d2a77f2e6ffb57099 ]
There is a small typo in phm_wait_on_indirect_register().
Swap mask and value arguments provided to phm_wait_on_register() so that they satisfy the function signature and actual usage scheme.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
In practice this doesn't fix any issues because the only place this function is used uses the same value for the value and mask.
--- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu_helper.c +1 -1
@@ -149,7 +149,7 @@ int phm_wait_on_indirect_register(struct pp_hwmgr *hwmgr, }cgs_write_register (hwmgr->device, indirect_port, index); -return phm_wait_on_register (hwmgr, indirect_port +1 , mask, value); +return phm_wait_on_register (hwmgr, indirect_port +1 , value, mask); } int phm_wait_for_register_unequal(struct pp_hwmgr *hwmgr,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 192/627 Revert "drm/amdgpu: fix slab-use-after-free in amdgpu_userq_mgr_fini"
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Prosyak <[email protected]>
[ Upstream commit a73345b866ff8bbd93135af667c973a8fb4b2c40 ]
This reverts commit 5fb90421fa0fbe0a968274912101fe917bf1c47b.
The original patch moved amdgpu_userq_mgr_fini() to the driver's postclose callback, which is called after drm_gem_release() in the DRM file cleanup sequence.If a user application crashes or aborts without cleaning up its user queues, 'drm_gem_release()` may free GEM objects that are still referenced by active user queues, leading to use-after-free. By reverting, we ensure that user queues are disabled and cleaned up before any GEM objects are released, preventing this class of bug. However, this reintroduces a race during PCI hot-unplug, where device removal can race with per-file cleanup, leading to use-after-free in suspend/unplug paths. This will be fixed in the next patch.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 16 +++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 --- 2 files changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +15 -1
@@ -2906,6 +2906,20 @@ static int amdgpu_pmops_runtime_idle(struct device *dev)return ret; } +static int amdgpu_drm_release (struct inode *inode,struct file *filp) +{ +struct drm_file *file_priv = filp->private_data; +struct amdgpu_fpriv *fpriv = file_priv->driver_priv; + +if (fpriv) { + fpriv->evf_mgr.fd_closing = true; +amdgpu_eviction_fence_destroy (&fpriv->evf_mgr); +amdgpu_userq_mgr_fini (&fpriv->userq_mgr); + } + +return drm_release (inode, filp); +} +long amdgpu_drm_ioctl (struct file *filp,unsigned int cmd,unsigned long arg) {
@@ -2957,7 +2971,7 @@ static const struct file_operations amdgpu_driver_kms_fops = { .owner = THIS_MODULE, .open = drm_open, .flush = amdgpu_flush, - .release = drm_release, + .release = amdgpu_drm_release, .unlocked_ioctl = amdgpu_drm_ioctl, .mmap = drm_gem_mmap, .poll = drm_poll,
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -3
@@ -1501,9 +1501,6 @@ void amdgpu_driver_postclose_kms(struct drm_device *dev,amdgpu_vm_bo_del (adev, fpriv->prt_va);amdgpu_bo_unreserve (pd); } - fpriv->evf_mgr.fd_closing = true; -amdgpu_eviction_fence_destroy (&fpriv->evf_mgr); -amdgpu_userq_mgr_fini (&fpriv->userq_mgr);amdgpu_ctx_mgr_fini (&fpriv->ctx_mgr);amdgpu_vm_fini (adev, &fpriv->vm);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 193/627 drm/amdgpu: fix use-after-free in amdgpu_userq_suspend+0x51a/0x5a0
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Prosyak <[email protected]>
[ Upstream commit a886d26f2c8f9e3f3c1869ae368d09c75daac553 ]
[ +0.000020] BUG: KASAN: slab-use-after-free in amdgpu_userq_suspend+0x51a/0x5a0 [amdgpu] [ +0.000817] Read of size 8 at addr ffff88812eec8c58 by task amd_pci_unplug/1733
[ +0.000027] CPU: 10 UID: 0 PID: 1733 Comm: amd_pci_unplug Tainted: G W 6.14.0+ #2 [ +0.000009] Tainted: [W]=WARN [ +0.000003] Hardware name: ASUS System Product Name/ROG STRIX B550-F GAMING (WI-FI), BIOS 1401 12/03/2020 [ +0.000004] Call Trace: [ +0.000004] <TASK> [ +0.000003] dump_stack_lvl+0x76/0xa0 [ +0.000011] print_report+0xce/0x600 [ +0.000009] ? srso_return_thunk+0x5/0x5f [ +0.000006] ? kasan_complete_mode_report_info+0x76/0x200 [ +0.000007] ? kasan_addr_to_slab+0xd/0xb0 [ +0.000006] ? amdgpu_userq_suspend+0x51a/0x5a0 [amdgpu] [ +0.000707] kasan_report+0xbe/0x110 [ +0.000006] ? amdgpu_userq_suspend+0x51a/0x5a0 [amdgpu] [ +0.000541] __asan_report_load8_noabort+0x14/0x30 [ +0.000005] amdgpu_userq_suspend+0x51a/0x5a0 [amdgpu] [ +0.000535] ? stop_cpsch+0x396/0x600 [amdgpu] [ +0.000556] ? stop_cpsch+0x429/0x600 [amdgpu] [ +0.000536] ? __pfx_amdgpu_userq_suspend+0x10/0x10 [amdgpu] [ +0.000536] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? kgd2kfd_suspend+0x132/0x1d0 [amdgpu] [ +0.000542] amdgpu_device_fini_hw+0x581/0xe90 [amdgpu] [ +0.000485] ? down_write+0xbb/0x140 [ +0.000007] ? __mutex_unlock_slowpath.constprop.0+0x317/0x360 [ +0.000005] ? __pfx_amdgpu_device_fini_hw+0x10/0x10 [amdgpu] [ +0.000482] ? __kasan_check_write+0x14/0x30 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? up_write+0x55/0xb0 [ +0.000007] ? srso_return_thunk+0x5/0x5f [ +0.000005] ? blocking_notifier_chain_unregister+0x6c/0xc0 [ +0.000008] amdgpu_driver_unload_kms+0x69/0x90 [amdgpu] [ +0.000484] amdgpu_pci_remove+0x93/0x130 [amdgpu] [ +0.000482] pci_device_remove+0xae/0x1e0 [ +0.000008] device_remove+0xc7/0x180 [ +0.000008] device_release_driver_internal+0x3d4/0x5a0 [ +0.000007] device_release_driver+0x12/0x20 [ +0.000004] pci_stop_bus_device+0x104/0x150 [ +0.000006] pci_stop_and_remove_bus_device_locked+0x1b/0x40 [ +0.000005] remove_store+0xd7/0xf0 [ +0.000005] ? __pfx_remove_store+0x10/0x10 [ +0.000006] ? __pfx__copy_from_iter+0x10/0x10 [ +0.000006] ? __pfx_dev_attr_store+0x10/0x10 [ +0.000006] dev_attr_store+0x3f/0x80 [ +0.000006] sysfs_kf_write+0x125/0x1d0 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000005] ? __kasan_check_write+0x14/0x30 [ +0.000005] kernfs_fop_write_iter+0x2ea/0x490 [ +0.000005] ? rw_verify_area+0x70/0x420 [ +0.000005] ? __pfx_kernfs_fop_write_iter+0x10/0x10 [ +0.000006] vfs_write+0x90d/0xe70 [ +0.000005] ? srso_return_thunk+0x5/0x5f [ +0.000005] ? __pfx_vfs_write+0x10/0x10 [ +0.000004] ? local_clock+0x15/0x30 [ +0.000008] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? __kasan_slab_free+0x5f/0x80 [ +0.000005] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? __kasan_check_read+0x11/0x20 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? fdget_pos+0x1d3/0x500 [ +0.000007] ksys_write+0x119/0x220 [ +0.000005] ? putname+0x1c/0x30 [ +0.000006] ? __pfx_ksys_write+0x10/0x10 [ +0.000007] __x64_sys_write+0x72/0xc0 [ +0.000006] x64_sys_call+0x18ab/0x26f0 [ +0.000006] do_syscall_64+0x7c/0x170 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? __pfx___x64_sys_openat+0x10/0x10 [ +0.000006] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? __kasan_check_read+0x11/0x20 [ +0.000003] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? fpregs_assert_state_consistent+0x21/0xb0 [ +0.000006] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? syscall_exit_to_user_mode+0x4e/0x240 [ +0.000005] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? do_syscall_64+0x88/0x170 [ +0.000003] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? irqentry_exit+0x43/0x50 [ +0.000004] ? srso_return_thunk+0x5/0x5f [ +0.000004] ? exc_page_fault+0x7c/0x110 [ +0.000006] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ +0.000006] RIP: 0033:0x7480c0b14887 [ +0.000005] Code: 10 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24 [ +0.000005] RSP: 002b:00007fff142b0058 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 [ +0.000006] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007480c0b14887 [ +0.000003] RDX: 0000000000000001 RSI: 00007480c0e7365a RDI: 0000000000000004 [ +0.000003] RBP: 00007fff142b0080 R08: 0000563b2e73c170 R09: 0000000000000000 [ +0.000003] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff142b02f8 [ +0.000003] R13: 0000563b159a72a9 R14: 0000563b159a9d48 R15: 00007480c0f19040 [ +0.000008] </TASK>
[ +0.000445] Allocated by task 427 on cpu 5 at 29.342331s: [ +0.000011] kasan_save_stack+0x28/0x60 [ +0.000006] kasan_save_track+0x18/0x70 [ +0.000006] kasan_save_alloc_info+0x38/0x60 [ +0.000005] __kasan_kmalloc+0xc1/0xd0 [ +0.000006] __kmalloc_cache_noprof+0x1bd/0x430 [ +0.000007] amdgpu_driver_open_kms+0x172/0x760 [amdgpu] [ +0.000493] drm_file_alloc+0x569/0x9a0 [ +0.000007] drm_client_init+0x1b7/0x410 [ +0.000007] drm_fbdev_client_setup+0x174/0x470 [ +0.000006] drm_client_setup+0x8a/0xf0 [ +0.000006] amdgpu_pci_probe+0x510/0x10c0 [amdgpu] [ +0.000483] local_pci_probe+0xe7/0x1b0 [ +0.000006] pci_device_probe+0x5bf/0x890 [ +0.000006] really_probe+0x1fd/0x950 [ +0.000005] __driver_probe_device+0x307/0x410 [ +0.000006] driver_probe_device+0x4e/0x150 [ +0.000005] __driver_attach+0x223/0x510 [ +0.000006] bus_for_each_dev+0x102/0x1a0 [ +0.000005] driver_attach+0x3d/0x60 [ +0.000006] bus_add_driver+0x309/0x650 [ +0.000005] driver_register+0x13d/0x490 [ +0.000006] __pci_register_driver+0x1ee/0x2b0 [ +0.000006] rfcomm_dlc_clear_state+0x69/0x220 [rfcomm] [ +0.000011] do_one_initcall+0x9c/0x3e0 [ +0.000007] do_init_module+0x29e/0x7f0 [ +0.000006] load_module+0x5c75/0x7c80 [ +0.000006] init_module_from_file+0x106/0x180 [ +0.000006] idempotent_init_module+0x377/0x740 [ +0.000006] __x64_sys_finit_module+0xd7/0x180 [ +0.000006] x64_sys_call+0x1f0b/0x26f0 [ +0.000006] do_syscall_64+0x7c/0x170 [ +0.000005] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ +0.000013] Freed by task 1733 on cpu 5 at 59.907086s: [ +0.000011] kasan_save_stack+0x28/0x60 [ +0.000006] kasan_save_track+0x18/0x70 [ +0.000005] kasan_save_free_info+0x3b/0x60 [ +0.000005] __kasan_slab_free+0x54/0x80 [ +0.000006] kfree+0x127/0x470 [ +0.000006] amdgpu_driver_postclose_kms+0x455/0x760 [amdgpu] [ +0.000493] drm_file_free.part.0+0x5b1/0xba0 [ +0.000006] drm_file_free+0x13/0x30 [ +0.000006] drm_client_release+0x1c4/0x2b0 [ +0.000006] drm_fbdev_ttm_fb_destroy+0xd2/0x120 [drm_ttm_helper] [ +0.000007] put_fb_info+0x97/0xe0 [ +0.000007] unregister_framebuffer+0x197/0x380 [ +0.000005] drm_fb_helper_unregister_info+0x94/0x100 [ +0.000005] drm_fbdev_client_unregister+0x3c/0x80 [ +0.000007] drm_client_dev_unregister+0x144/0x330 [ +0.000006] drm_dev_unregister+0x49/0x1b0 [ +0.000006] drm_dev_unplug+0x4c/0xd0 [ +0.000006] amdgpu_pci_remove+0x58/0x130 [amdgpu] [ +0.000484] pci_device_remove+0xae/0x1e0 [ +0.000008] device_remove+0xc7/0x180 [ +0.000007] device_release_driver_internal+0x3d4/0x5a0 [ +0.000006] device_release_driver+0x12/0x20 [ +0.000007] pci_stop_bus_device+0x104/0x150 [ +0.000006] pci_stop_and_remove_bus_device_locked+0x1b/0x40 [ +0.000006] remove_store+0xd7/0xf0 [ +0.000006] dev_attr_store+0x3f/0x80 [ +0.000005] sysfs_kf_write+0x125/0x1d0 [ +0.000006] kernfs_fop_write_iter+0x2ea/0x490 [ +0.000006] vfs_write+0x90d/0xe70 [ +0.000006] ksys_write+0x119/0x220 [ +0.000006] __x64_sys_write+0x72/0xc0 [ +0.000006] x64_sys_call+0x18ab/0x26f0 [ +0.000005] do_syscall_64+0x7c/0x170 [ +0.000006] entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ +0.000012] The buggy address belongs to the object at ffff88812eec8000
which belongs to the cache kmalloc-rnd-07-4k of size 4096
[ +0.000016] The buggy address is located 3160 bytes inside of
freed 4096-byte region [ffff88812eec8000, ffff88812eec9000)
[ +0.000023] The buggy address belongs to the physical page: [ +0.000009] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x12eec8 [ +0.000007] head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 [ +0.000005] flags: 0x17ffffc0000040(head|node=0|zone=2|lastcpupid=0x1fffff) [ +0.000007] page_type: f5(slab) [ +0.000008] raw: 0017ffffc0000040 ffff888100054500 dead000000000122 0000000000000000 [ +0.000005] raw: 0000000000000000 0000000080040004 00000000f5000000 0000000000000000 [ +0.000006] head: 0017ffffc0000040 ffff888100054500 dead000000000122 0000000000000000 [ +0.000005] head: 0000000000000000 0000000080040004 00000000f5000000 0000000000000000 [ +0.000006] head: 0017ffffc0000003 ffffea0004bbb201 ffffffffffffffff 0000000000000000 [ +0.000005] head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 [ +0.000005] page dumped because: kasan: bad access detected
[ +0.000010] Memory state around the buggy address: [ +0.000009] ffff88812eec8b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000012] ffff88812eec8b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] >ffff88812eec8c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] ^ [ +0.000010] ffff88812eec8c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] ffff88812eec8d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ +0.000011] ==================================================================
The use-after-free occurs because a delayed work item (suspend_work) may still be pending or running when resources it accesses are freed during device removal or file close. The previous code used flush_work(&fpriv->evf_mgr.suspend_work.work), which does not wait for delayed work that has not yet started. As a result, the delayed work could run after its memory was freed, causing a use-after-free. By switching to flush_delayed_work(&fpriv->evf_mgr.suspend_work), we ensure that the kernel waits for both queued and delayed work to finish before freeing memory, closing this race.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c +1 -1
@@ -664,7 +664,7 @@ static void amdgpu_userq_restore_worker(struct work_struct *work)struct amdgpu_fpriv *fpriv =uq_mgr_to_fpriv (uq_mgr);int ret; -flush_work (&fpriv->evf_mgr.suspend_work.work); +flush_delayed_work (&fpriv->evf_mgr.suspend_work);mutex_lock (&uq_mgr->userq_mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 194/627 wifi: ath12k: Block radio bring-up in FTM mode
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaradhana Sahu <[email protected]>
[ Upstream commit 80570587e418f361e7ce3f9200477f728b38c94b ]
Ensure that all radios remain down when the driver operates in Factory Test Mode (FTM). Reject any userspace attempts to bring up an interface in this mode.
Currently, the driver allows userspace to bring up the interface even though it operates in FTM mode, which violates FTM constraints and leads to FTM command failures.
Hence, block the radio start when the driver is in FTM mode. Also, remove ath12k_ftm_mode check from ath12k_drain_tx() because FTM mode check is already handled in the caller function (ath12k_mac_op_start()).
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-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 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +4 -6
@@ -8167,14 +8167,9 @@ static int ath12k_mac_start(struct ath12k *ar)static void ath12k_drain_tx (struct ath12k_hw *ah) { -struct ath12k *ar = ah->radio; +struct ath12k *ar;int i; -if (ath12k_ftm_mode) { -ath12k_err (ar->ab,"fail to start mac operations in ftm mode\n" ); -return ; - } -lockdep_assert_wiphy (ah->hw->wiphy);for_each_ar (ah, ar, i)
@@ -8187,6 +8182,9 @@ static int ath12k_mac_op_start(struct ieee80211_hw *hw)struct ath12k *ar;int ret, i; +if (ath12k_ftm_mode) +return -EPERM ; +lockdep_assert_wiphy (hw->wiphy);ath12k_drain_tx (ah);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 195/627 arm64: fix unnecessary rebuilding when CONFIG_DEBUG_EFI=y
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 344b6580472451390d070c65c27f59716a1deecb ]
When CONFIG_DEBUG_EFI is enabled, some objects are needlessly rebuilt.
[Steps to reproduce]
Enable CONFIG_DEBUG_EFI and run 'make' twice in a clean source tree. On the second run, arch/arm64/kernel/head.o is rebuilt even though no files have changed.
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- clean
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
[ snip ]
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
CALL scripts/checksyscalls.sh
AS arch/arm64/kernel/head.o
AR arch/arm64/kernel/built-in.a
AR arch/arm64/built-in.a
AR built-in.a
[ snip ]The issue is caused by the use of the $(realpath ...) function.
At the time arch/arm64/kernel/Makefile is parsed on the first run, $(objtree)/vmlinux does not exist. As a result, $(realpath $(objtree)/vmlinux) expands to an empty string.
On the second run of Make, $(objtree)/vmlinux already exists, so $(realpath $(objtree)/vmlinux) expands to the absolute path of vmlinux. However, this change in the command line causes arch/arm64/kernel/head.o to be rebuilt.
To address this issue, use $(abspath ...) instead, which does not require the file to exist. While $(abspath ...) does not resolve symlinks, this should be fine from a debugging perspective.
The GNU Make manual [1] clearly explains the difference between the two:
$(realpath names...)
For each file name in names return the canonical absolute name. A canonical name does not contain any . or .. components, nor any repeated path separators (/) or symlinks. In case of a failure the empty string is returned. Consult the realpath(3) documentation for a list of possible failure causes.
$(abspath namees...)
For each file name in names return an absolute name that does not contain any . or .. components, nor any repeated path separators (/). Note that, in contrast to realpath function, abspath does not resolve symlinks and does not require the file names to refer to an existing file or directory. Use the wildcard function to test for existence.
The same problem exists in drivers/firmware/efi/libstub/Makefile.zboot. On the first run of Make, $(obj)/vmlinuz.efi.elf does not exist when the Makefile is parsed, so -DZBOOT_EFI_PATH is set to an empty string. Replace $(realpath ...) with $(abspath ...) there as well.
[1]: https://www.gnu.org/software/make/manual/make.html#File-Name-Functions
--- arch/arm64/kernel/Makefile | 2 +- drivers/firmware/efi/libstub/Makefile.zboot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kernel/Makefile +1 -1
@@ -80,7 +80,7 @@ obj-y += head.o always-$(KBUILD_BUILTIN) += vmlinux.lds ifeq ($(CONFIG_DEBUG_EFI),y) -AFLAGS_head.o += -DVMLINUX_PATH="\"$(realpath $(objtree)/vmlinux)\"" +AFLAGS_head.o += -DVMLINUX_PATH="\"$(abspath vmlinux)\"" endif # for cleaning
drivers/firmware/efi/libstub/Makefile.zboot +1 -1
@@ -36,7 +36,7 @@ aflags-zboot-header-$(EFI_ZBOOT_FORWARD_CFI) := \ -DPE_DLL_CHAR_EX=IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT AFLAGS_zboot-header.o += -DMACHINE_TYPE=IMAGE_FILE_MACHINE_$(EFI_ZBOOT_MACH_TYPE) \ - -DZBOOT_EFI_PATH="\"$(realpath $(obj)/vmlinuz.efi.elf)\"" \ + -DZBOOT_EFI_PATH="\"$(abspath $(obj)/vmlinuz.efi.elf)\"" \ -DZBOOT_SIZE_LEN=$(zboot-size-len-y) \ -DCOMP_TYPE="\"$(comp-type-y)\"" \ $(aflags-zboot-header-y)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 196/627 drm/rockchip: vop2: fail cleanly if missing a primary plane for a video-port
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit f9f68bf1d0efeadb6c427c9dbb30f307a7def19b ]
Each window of a vop2 is usable by a specific set of video ports, so while binding the vop2, we look through the list of available windows trying to find one designated as primary-plane and usable by that specific port.
The code later wants to use drm_crtc_init_with_planes with that found primary plane, but nothing has checked so far if a primary plane was actually found.
For whatever reason, the rk3576 vp2 does not have a usable primary window (if vp0 is also in use) which brought the issue to light and ended in a null-pointer dereference further down.
As we expect a primary-plane to exist for a video-port, add a check at the end of the window-iteration and fail probing if none was found.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +4 -0
@@ -2422,6 +2422,10 @@ static int vop2_create_crtcs(struct vop2 *vop2)break ; } } + +if (!vp->primary_plane) +return dev_err_probe (drm->dev, -ENOENT , +"no primary plane for vp %d\n" , i); }/* Register all unused window as overlay plane */
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 197/627 drm/rockchip: vop2: Fix the update of LAYER/PORT select registers when there are multi display output on rk3588/rk3568
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Yan <[email protected]>
[ Upstream commit 3e89a8c6835476aa782da80585dee9ddae651eea ]
The all video ports of rk3568/rk3588 share the same OVL_LAYER_SEL and OVL_PORT_SEL registers, and the configuration of these two registers can be set to take effect when the vsync signal arrives at a certain Video Port.
If two threads for two display output choose to update these two registers simultaneously to meet their own plane adjustment requirements(change plane zpos or switch plane from one crtc to another), then no matter which Video Port'svsync signal we choose to follow for these two registers, the display output of the other Video Port will be abnormal.
This is because the configuration of this Video Port does not take effect at the right time (its configuration should take effect when its VSYNC signal arrives).
In order to solve this problem, when performing plane migration or change the zpos of planes, there are two things to be observed and followed:
1. When a plane is migrated from one VP to another, the configuration of the layer can only take effect after the Port mux configuration is enabled.
2. When change the zpos of planes, we must ensure that the change for the previous VP takes effect before we proceed to change the next VP. Otherwise, the new configuration might overwrite the previous one for the previous VP, or it could lead to the configuration of the previous VP being take effect along with the VSYNC of the new VP.
This issue only occurs in scenarios where multi-display output is enabled.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 25 ++---- drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 33 ++++++++ drivers/gpu/drm/rockchip/rockchip_vop2_reg.c | 89 ++++++++++++++++++-- 3 files changed, 122 insertions(+), 25 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +6 -19
@@ -146,25 +146,6 @@ static void vop2_unlock(struct vop2 *vop2)mutex_unlock (&vop2->vop2_lock); } -/* -* Note: -* The write mask function is documented but missing on rk3566/8, writes -* to these bits have no effect. For newer soc(rk3588 and following) the -* write mask is needed for register writes. -* -* GLB_CFG_DONE_EN has no write mask bit. -* -*/ -static void vop2_cfg_done (struct vop2_video_port *vp) -{ -struct vop2 *vop2 = vp->vop2; -u32 val =RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN ; - - val |=BIT (vp->id) | (BIT (vp->id) <<16 ); - -regmap_set_bits (vop2->map,RK3568_REG_CFG_DONE , val); -} -static void vop2_win_disable (struct vop2_win *win) {vop2_win_write (win,VOP2_WIN_ENABLE ,0 );
@@ -854,6 +835,11 @@ static void vop2_enable(struct vop2 *vop2)if (vop2->version ==VOP_VERSION_RK3588 )rk3588_vop2_power_domain_enable_all (vop2); +if (vop2->version <=VOP_VERSION_RK3588 ) { + vop2->old_layer_sel =vop2_readl (vop2,RK3568_OVL_LAYER_SEL ); + vop2->old_port_sel =vop2_readl (vop2,RK3568_OVL_PORT_SEL ); + } +vop2_writel (vop2,RK3568_REG_CFG_DONE ,RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN );/*
@@ -2728,6 +2714,7 @@ static int vop2_bind(struct device *dev, struct device *master, void *data)return dev_err_probe (drm->dev, vop2->irq,"cannot find irq for vop2\n" );mutex_init (&vop2->vop2_lock); +mutex_init (&vop2->ovl_lock); ret =devm_request_irq (dev, vop2->irq, vop2_isr,IRQF_SHARED ,dev_name (dev), vop2);if (ret)
drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +33 -0
@@ -334,6 +334,19 @@ struct vop2 {/* optional internal rgb encoder */ struct rockchip_rgb *rgb; +/* +* Used to record layer selection configuration on rk356x/rk3588 +* as register RK3568_OVL_LAYER_SEL and RK3568_OVL_PORT_SEL are +* shared for all the Video Ports. +*/ +u32 old_layer_sel; +u32 old_port_sel; +/* +* Ensure that the updates to these two registers(RKK3568_OVL_LAYER_SEL/RK3568_OVL_PORT_SEL) +* take effect in sequence. +*/ +struct mutex ovl_lock; +/* must be put at the end of the struct */ struct vop2_win win[]; };
@@ -727,6 +740,7 @@ enum dst_factor_mode {#define RK3588_OVL_PORT_SEL__CLUSTER2 GENMASK(21, 20)#define RK3568_OVL_PORT_SEL__CLUSTER1 GENMASK(19, 18)#define RK3568_OVL_PORT_SEL__CLUSTER0 GENMASK(17, 16) +#define RK3588_OVL_PORT_SET__PORT3_MUX GENMASK(15, 12)#define RK3568_OVL_PORT_SET__PORT2_MUX GENMASK(11, 8)#define RK3568_OVL_PORT_SET__PORT1_MUX GENMASK(7, 4)#define RK3568_OVL_PORT_SET__PORT0_MUX GENMASK(3, 0)
@@ -831,4 +845,23 @@ static inline struct vop2_win *to_vop2_win(struct drm_plane *p) return container_of(p, struct vop2_win, base); } +/* +* Note: +* The write mask function is documented but missing on rk3566/8, writes +* to these bits have no effect. For newer soc(rk3588 and following) the +* write mask is needed for register writes. +* +* GLB_CFG_DONE_EN has no write mask bit. +* +*/ +static inline void vop2_cfg_done (struct vop2_video_port *vp) +{ +struct vop2 *vop2 = vp->vop2; +u32 val =RK3568_REG_CFG_DONE__GLB_CFG_DONE_EN ; + + val |=BIT (vp->id) | (BIT (vp->id) <<16 ); + +regmap_set_bits (vop2->map,RK3568_REG_CFG_DONE , val); +} +#endif /* _ROCKCHIP_DRM_VOP2_H */
drivers/gpu/drm/rockchip/rockchip_vop2_reg.c +83 -6
129 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 198/627 sched/psi: Optimize psi_group_change() cpu_clock() usage
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit 570c8efd5eb79c3725ba439ce105ed1bedc5acd9 ]
Dietmar reported that commit 3840cbe24cf0 ("sched: psi: fix bogus pressure spikes from aggregation race") caused a regression for him on a high context switch rate benchmark (schbench) due to the now repeating cpu_clock() calls.
In particular the problem is that get_recent_times() will extrapolate the current state to 'now'. But if an update uses a timestamp from before the start of the update, it is possible to get two reads with inconsistent results. It is effectively back-dating an update.
(note that this all hard-relies on the clock being synchronized across CPUs -- if this is not the case, all bets are off).
Combine this problem with the fact that there are per-group-per-cpu seqcounts, the commit in question pushed the clock read into the group iteration, causing tree-depth cpu_clock() calls. On architectures where cpu_clock() has appreciable overhead, this hurts.
Instead move to a per-cpu seqcount, which allows us to have a single clock read for all group updates, increasing internal consistency and lowering update overhead. This comes at the cost of a longer update side (proportional to the tree depth) which can cause the read side to retry more often.
--- include/linux/psi_types.h | 6 +- kernel/sched/psi.c | 121 +++++++++++++++++++++----------------- 2 files changed, 68 insertions(+), 59 deletions(-)
include/linux/psi_types.h +2 -4
@@ -84,11 +84,9 @@ enum psi_aggregators {struct psi_group_cpu {/* 1st cacheline updated by the scheduler */ -/* Aggregator needs to know of concurrent changes */ -seqcount_t seq____cacheline_aligned_in_smp ; -/* States of the tasks belonging to this group */ -unsigned int tasks[NR_PSI_TASK_COUNTS ]; +unsigned int tasks[NR_PSI_TASK_COUNTS ] +____cacheline_aligned_in_smp ;/* Aggregate pressure state derived from the tasks */ u32 state_mask;
kernel/sched/psi.c +66 -55
255 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 199/627 sched/deadline: Less agressive dl_server handling
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit cccb45d7c4295bbfeba616582d0249f2d21e6df5 ]
Chris reported that commit 5f6bd380c7bd ("sched/rt: Remove default bandwidth control") caused a significant dip in his favourite benchmark of the day. Simply disabling dl_server cured things.
His workload hammers the 0->1, 1->0 transitions, and the dl_server_{start,stop}() overhead kills it -- fairly obviously a bad idea in hind sight and all that.
Change things around to only disable the dl_server when there has not been a fair task around for a whole period. Since the default period is 1 second, this ensures the benchmark never trips this, overhead gone.
--- include/linux/sched.h | 1 + kernel/sched/deadline.c | 25 ++++++++++++++++++++++--- kernel/sched/fair.c | 9 --------- 3 files changed, 23 insertions(+), 12 deletions(-)
include/linux/sched.h +1 -0
@@ -701,6 +701,7 @@ struct sched_dl_entity { unsigned int dl_defer : 1; unsigned int dl_defer_armed : 1; unsigned int dl_defer_running : 1; + unsigned int dl_server_idle : 1;/* * Bandwidth enforcement timer. Each -deadline task has its
kernel/sched/deadline.c +22 -3
@@ -1215,6 +1215,8 @@ static void __push_dl_task(struct rq *rq, struct rq_flags *rf)/* a defer timer will not be reset if the runtime consumed was < dl_server_min_res */ static const u64 dl_server_min_res =1 *NSEC_PER_MSEC ; +static bool dl_server_stopped (struct sched_dl_entity *dl_se); +static enum hrtimer_restart dl_server_timer (struct hrtimer *timer,struct sched_dl_entity *dl_se) {struct rq *rq =rq_of_dl_se (dl_se);
@@ -1234,6 +1236,7 @@ static enum hrtimer_restart dl_server_timer(struct hrtimer *timer, struct sched_if (!dl_se->server_has_tasks (dl_se)) {replenish_dl_entity (dl_se); +dl_server_stopped (dl_se);return HRTIMER_NORESTART ; }
@@ -1639,8 +1642,10 @@ void dl_server_update_idle_time(struct rq *rq, struct task_struct *p)void dl_server_update (struct sched_dl_entity *dl_se,s64 delta_exec) {/* 0 runtime = fair server disabled */ -if (dl_se->dl_runtime) +if (dl_se->dl_runtime) { + dl_se->dl_server_idle =0 ;update_curr_dl_se (dl_se->rq, dl_se, delta_exec); + } }void dl_server_start (struct sched_dl_entity *dl_se)
@@ -1663,7 +1668,7 @@ void dl_server_start(struct sched_dl_entity *dl_se)setup_new_dl_entity (dl_se); } -if (!dl_se->dl_runtime) +if (!dl_se->dl_runtime || dl_se->dl_server_active)return ; dl_se->dl_server_active =1 ;
@@ -1684,6 +1689,20 @@ void dl_server_stop(struct sched_dl_entity *dl_se) dl_se->dl_server_active =0 ; } +static bool dl_server_stopped (struct sched_dl_entity *dl_se) +{ +if (!dl_se->dl_server_active) +return false; + +if (dl_se->dl_server_idle) { +dl_server_stop (dl_se); +return true; + } + + dl_se->dl_server_idle =1 ; +return false; +} +void dl_server_init (struct sched_dl_entity *dl_se,struct rq *rq,dl_server_has_tasks_f has_tasks,dl_server_pick_f pick_task)
@@ -2435,7 +2454,7 @@ static struct task_struct *__pick_task_dl(struct rq *rq)if (dl_server (dl_se)) { p = dl_se->server_pick_task (dl_se);if (!p) { -if (dl_server_active (dl_se)) { +if (!dl_server_stopped (dl_se)) { dl_se->dl_yielded =1 ;update_curr_dl_se (rq, dl_se,0 ); }
kernel/sched/fair.c +0 -9
@@ -5889,7 +5889,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)struct cfs_bandwidth *cfs_b =tg_cfs_bandwidth (cfs_rq->tg);struct sched_entity *se;long queued_delta, runnable_delta, idle_delta, dequeue =1 ; -long rq_h_nr_queued = rq->cfs.h_nr_queued;raw_spin_lock (&cfs_b->lock);/* This will start the period timer if necessary */
@@ -5973,10 +5972,6 @@ static bool throttle_cfs_rq(struct cfs_rq *cfs_rq)/* At this point se is NULL and we are at root level*/ sub_nr_running (rq, queued_delta); - -/* Stop the fair server if throttling resulted in no runnable tasks */ -if (rq_h_nr_queued && !rq->cfs.h_nr_queued) -dl_server_stop (&rq->fair_server); done:/* * Note: distribution will already see us throttled via the
@@ -7070,7 +7065,6 @@ static void set_next_buddy(struct sched_entity *se);static int dequeue_entities (struct rq *rq,struct sched_entity *se,int flags) {bool was_sched_idle =sched_idle_rq (rq); -int rq_h_nr_queued = rq->cfs.h_nr_queued;bool task_sleep = flags &DEQUEUE_SLEEP ;bool task_delayed = flags &DEQUEUE_DELAYED ;struct task_struct *p =NULL ;
@@ -7154,9 +7148,6 @@ static int dequeue_entities(struct rq *rq, struct sched_entity *se, int flags)sub_nr_running (rq, h_nr_queued); -if (rq_h_nr_queued && !rq->cfs.h_nr_queued) -dl_server_stop (&rq->fair_server); -/* balance early to pull high priority tasks */ if (unlikely (!was_sched_idle &&sched_idle_rq (rq))) rq->next_balance = jiffies;
Signature · 1 line
2.39.5
Re: [PATCH 6.16 199/627] sched/deadline: Less agressive dl_server handling
Hi,
Quoted 12 lines · Greg Kroah-Hartman
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit
cccb45d7c4295bbfeba616582d0249f2d21e6df5]Chris reported that commit
5f6bd380c7bd("sched/rt: Remove default bandwidth control") caused a significant dip in his favourite benchmark of the day. Simply disablingdl_servercured things.
Quoted 8 lines
His workload hammers the 0->1, 1->0 transitions, and the dl_server_{start,stop}() overhead kills it -- fairly obviously a bad idea in hind sight and all that.
Change things around to only disable the
dl_serverwhen there has not been a fair task around for a whole period. Since the default period is 1 second, this ensures the benchmark never trips this, overhead gone.
This causes:
sched: DL replenish lagged too much
Maybe some prereq missing?
Quoted 7 lines
Fixes 557a6bfc662c ("sched/fair: Add trivial fair server")Reported-by Chris Mason <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Reviewed-by Juri Lelli <[email protected]>Acked-by Juri Lelli <[email protected]>Signed-off-by Sasha Levin <[email protected]>
thanks,
Signature · 2 lines
js suse labs
Re: [PATCH 6.16 199/627] sched/deadline: Less agressive dl_server handling
Quoted 25 lines · Jiri Slaby
Hi,
Quoted 12 lines · Greg Kroah-Hartman
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit
cccb45d7c4295bbfeba616582d0249f2d21e6df5]Chris reported that commit
5f6bd380c7bd("sched/rt: Remove default bandwidth control") caused a significant dip in his favourite benchmark of the day. Simply disablingdl_servercured things.Quoted 8 lines
His workload hammers the 0->1, 1->0 transitions, and the dl_server_{start,stop}() overhead kills it -- fairly obviously a bad idea in hind sight and all that.
Change things around to only disable the
dl_serverwhen there has not been a fair task around for a whole period. Since the default period is 1 second, this ensures the benchmark never trips this, overhead gone.
Quoted 4 lines
This causes:
sched: DL replenish lagged too muchMaybe some prereq missing?
Not really, this is present both in linus/master and tip/master.
Quoted 9 lines
Quoted 7 lines
Fixes 557a6bfc662c ("sched/fair: Add trivial fair server")Reported-by Chris Mason <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Reviewed-by Juri Lelli <[email protected]>Acked-by Juri Lelli <[email protected]>Signed-off-by Sasha Levin <[email protected]>thanks,
Signature · 2 lines
js suse labs
Re: [PATCH 6.16 199/627] sched/deadline: Less agressive dl_server handling
Hi,
Quoted 27 lines · Jiri Slaby
Quoted 26 lines · Jiri Slaby
Hi,
Quoted 21 lines · Greg Kroah-Hartman
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit
cccb45d7c4295bbfeba616582d0249f2d21e6df5]Chris reported that commit
5f6bd380c7bd("sched/rt: Remove default bandwidth control") caused a significant dip in his favourite benchmark of the day. Simply disablingdl_servercured things.His workload hammers the 0->1, 1->0 transitions, and the dl_server_{start,stop}() overhead kills it -- fairly obviously a bad idea in hind sight and all that.
Change things around to only disable the
dl_serverwhen there has not been a fair task around for a whole period. Since the default period is 1 second, this ensures the benchmark never trips this, overhead gone.
Quoted 6 lines
Quoted 4 lines
This causes:
sched: DL replenish lagged too muchMaybe some prereq missing?
Not really, this is present both in linus/master and tip/master.
https://lore.kernel.org/lkml/[email protected]/
should be addressing it, but still under review.
Thanks,
Juri
Greg Kroah-Hartman
maintainerRe: [PATCH 6.16 199/627] sched/deadline: Less agressive dl_server handling
In reply to Jiri SlabyQuoted 27 lines · Jiri Slaby
Quoted 26 lines · Jiri Slaby
Hi,
Quoted 21 lines · Greg Kroah-Hartman
6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
[ Upstream commit
cccb45d7c4295bbfeba616582d0249f2d21e6df5]Chris reported that commit
5f6bd380c7bd("sched/rt: Remove default bandwidth control") caused a significant dip in his favourite benchmark of the day. Simply disablingdl_servercured things.His workload hammers the 0->1, 1->0 transitions, and the dl_server_{start,stop}() overhead kills it -- fairly obviously a bad idea in hind sight and all that.
Change things around to only disable the
dl_serverwhen there has not been a fair task around for a whole period. Since the default period is 1 second, this ensures the benchmark never trips this, overhead gone.
Quoted 15 lines
Quoted 4 lines
This causes:
sched: DL replenish lagged too muchMaybe some prereq missing?
Not really, this is present both in linus/master and tip/master.
Quoted 9 lines
Quoted 7 lines
Fixes 557a6bfc662c ("sched/fair: Add trivial fair server")Reported-by Chris Mason <[email protected]>Signed-off-by Peter Zijlstra (Intel) <[email protected]>Reviewed-by Juri Lelli <[email protected]>Acked-by Juri Lelli <[email protected]>Signed-off-by Sasha Levin <[email protected]>thanks,
Ok, I'll move this out of this release and queue it up for the "next one".
thanks,
greg k-h
Greg Kroah-Hartman
maintainerPATCH 200/627 fbcon: Fix outdated registered_fb reference in comment
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shixiong Ou <[email protected]>
[ Upstream commit 0f168e7be696a17487e83d1d47e5a408a181080f ]
The variable was renamed to fbcon_registered_fb, but this comment was not updated along with the change. Correct it to avoid confusion.
--- drivers/video/fbdev/core/fbcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/core/fbcon.c +2 -2
@@ -952,13 +952,13 @@ static const char *fbcon_startup(void)int rows, cols;/* -* If num_registered_fb is zero, this is a call for the dummy part. +* If fbcon_num_registered_fb is zero, this is a call for the dummy part. * The frame buffer devices weren't initialized yet. */ if (!fbcon_num_registered_fb || info_idx ==-1 )return display_desc;/* -* Instead of blindly using registered_fb[0], we use info_idx, set by +* Instead of blindly using fbcon_registered_fb[0], we use info_idx, set by * fbcon_fb_registered(); */ info = fbcon_registered_fb[info_idx];
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 201/627 netfilter: nf_tables: Drop dead code from fill_*_info routines
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit 8080357a8c6cf4905bbd8969412c19d34be3395e ]
This practically reverts commit 28339b21a365 ("netfilter: nf_tables: do not send complete notification of deletions"): The feature was never effective, due to prior modification of 'event' variable the conditional early return never happened.
User space also relies upon the current behaviour, so better reintroduce the shortened deletion notifications once it is fixed.
--- net/netfilter/nf_tables_api.c | 25 ------------------------- 1 file changed, 25 deletions(-)
net/netfilter/nf_tables_api.c +0 -25
@@ -1165,11 +1165,6 @@ static int nf_tables_fill_table_info(struct sk_buff *skb, struct net *net, NFTA_TABLE_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELTABLE ) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nla_put_be32 (skb,NFTA_TABLE_FLAGS ,htonl (table->flags &NFT_TABLE_F_MASK ))) goto nla_put_failure;
@@ -2028,11 +2023,6 @@ static int nf_tables_fill_chain_info(struct sk_buff *skb, struct net *net, NFTA_CHAIN_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELCHAIN && !hook_list) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nft_is_base_chain (chain)) {const struct nft_base_chain *basechain =nft_base_chain (chain);struct nft_stats __percpu *stats;
@@ -4859,11 +4849,6 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, NFTA_SET_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELSET ) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (set->flags !=0 )if (nla_put_be32 (skb,NFTA_SET_FLAGS ,htonl (set->flags))) goto nla_put_failure;
@@ -8350,11 +8335,6 @@ static int nf_tables_fill_obj_info(struct sk_buff *skb, struct net *net, NFTA_OBJ_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELOBJ ) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nla_put_be32 (skb,NFTA_OBJ_TYPE ,htonl (obj->ops->type->type)) ||nla_put_be32 (skb,NFTA_OBJ_USE ,htonl (obj->use)) ||nft_object_dump (skb,NFTA_OBJ_DATA , obj, reset))
@@ -9394,11 +9374,6 @@ static int nf_tables_fill_flowtable_info(struct sk_buff *skb, struct net *net, NFTA_FLOWTABLE_PAD)) goto nla_put_failure; -if (event ==NFT_MSG_DELFLOWTABLE && !hook_list) { -nlmsg_end (skb, nlh); -return 0 ; - } -if (nla_put_be32 (skb,NFTA_FLOWTABLE_USE ,htonl (flowtable->use)) ||nla_put_be32 (skb,NFTA_FLOWTABLE_FLAGS ,htonl (flowtable->data.flags))) goto nla_put_failure;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 202/627 netfilter: nf_tables: adjust lockdep assertions handling
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 8df1b40de76979bb8e975201d07b71103d5de820 ]
It's needed to check the return value of lockdep_commit_lock_is_held(), otherwise there's no point in this assertion as it doesn't print any debug information on itself.
Found by Linux Verification Center (linuxtesting.org) with Svace static analysis tool.
--- net/netfilter/nf_tables_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_tables_api.c +2 -2
@@ -4029,7 +4029,7 @@ void nf_tables_rule_destroy(const struct nft_ctx *ctx, struct nft_rule *rule)/* can only be used if rule is no longer visible to dumps */ static void nf_tables_rule_release (const struct nft_ctx *ctx,struct nft_rule *rule) { -lockdep_commit_lock_is_held (ctx->net); +WARN_ON_ONCE (!lockdep_commit_lock_is_held (ctx->net));nft_rule_expr_deactivate (ctx, rule,NFT_TRANS_RELEASE );nf_tables_rule_destroy (ctx, rule);
@@ -5844,7 +5844,7 @@ void nf_tables_deactivate_set(const struct nft_ctx *ctx, struct nft_set *set,struct nft_set_binding *binding, enum nft_trans_phase phase) { - lockdep_commit_lock_is_held(ctx->net); + WARN_ON_ONCE(!lockdep_commit_lock_is_held(ctx->net));switch (phase) {case NFT_TRANS_PREPARE_ERROR :
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 203/627 drm/panthor: Fix UAF in panthor_gem_create_with_handle() debugfs code
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Simona Vetter <[email protected]>
[ Upstream commit fe69a391808404977b1f002a6e7447de3de7a88e ]
The object is potentially already gone after the drm_gem_object_put(). In general the object should be fully constructed before calling drm_gem_handle_create(), except the debugfs tracking uses a separate lock and list and separate flag to denotate whether the object is actually initialized.
Since I'm touching this all anyway simplify this by only adding the object to the debugfs when it's ready for that, which allows us to delete that separate flag. panthor_gem_debugfs_bo_rm() already checks whether we've actually been added to the list or this is some error path cleanup.
v2: Fix build issues for !CONFIG_DEBUGFS (Adrián)
v3: Add linebreak and remove outdated comment (Liviu)
--- drivers/gpu/drm/panthor/panthor_gem.c | 31 +++++++++++++-------------- drivers/gpu/drm/panthor/panthor_gem.h | 3 --- 2 files changed, 15 insertions(+), 19 deletions(-)
drivers/gpu/drm/panthor/panthor_gem.c +15 -16
@@ -16,10 +16,15 @@#include "panthor_mmu.h" #ifdef CONFIG_DEBUG_FS -static void panthor_gem_debugfs_bo_add (struct panthor_device *ptdev, -struct panthor_gem_object *bo) +static void panthor_gem_debugfs_bo_init (struct panthor_gem_object *bo) {INIT_LIST_HEAD (&bo->debugfs.node); +} + +static void panthor_gem_debugfs_bo_add (struct panthor_gem_object *bo) +{ +struct panthor_device *ptdev =container_of (bo->base.base.dev, + struct panthor_device, base); bo->debugfs.creator.tgid = current->group_leader->pid;get_task_comm (bo->debugfs.creator.process_name, current->group_leader);
@@ -44,14 +49,13 @@ static void panthor_gem_debugfs_bo_rm(struct panthor_gem_object *bo)static void panthor_gem_debugfs_set_usage_flags (struct panthor_gem_object *bo,u32 usage_flags) { - bo->debugfs.flags = usage_flags |PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED ; + bo->debugfs.flags = usage_flags; +panthor_gem_debugfs_bo_add (bo); }#else -static void panthor_gem_debugfs_bo_add (struct panthor_device *ptdev, -struct panthor_gem_object *bo) -{}static void panthor_gem_debugfs_bo_rm (struct panthor_gem_object *bo) {}static void panthor_gem_debugfs_set_usage_flags (struct panthor_gem_object *bo,u32 usage_flags) {} +static void panthor_gem_debugfs_bo_init (struct panthor_gem_object *bo) {}#endif static void panthor_gem_free_object (struct drm_gem_object *obj)
@@ -246,7 +250,7 @@ struct drm_gem_object *panthor_gem_create_object(struct drm_device *ddev, size_tdrm_gem_gpuva_set_lock (&obj->base.base, &obj->gpuva_list_lock);mutex_init (&obj->label.lock); -panthor_gem_debugfs_bo_add (ptdev, obj); +panthor_gem_debugfs_bo_init (obj);return &obj->base.base; }
@@ -285,6 +289,8 @@ panthor_gem_create_with_handle(struct drm_file *file, bo->base.base.resv = bo->exclusive_vm_root_gem->resv; } +panthor_gem_debugfs_set_usage_flags (bo,0 ); +/* * Allocate an id of idr table where the obj is registered * and handle has the id what user can see.
@@ -296,12 +302,6 @@ panthor_gem_create_with_handle(struct drm_file *file,/* drop reference from allocate - handle holds it now. */ drm_gem_object_put (&shmem->base); -/* -* No explicit flags are needed in the call below, since the -* function internally sets the INITIALIZED bit for us. -*/ -panthor_gem_debugfs_set_usage_flags (bo,0 ); -return ret; }
@@ -387,7 +387,7 @@ static void panthor_gem_debugfs_bo_print(struct panthor_gem_object *bo,unsigned int refcount =kref_read (&bo->base.base.refcount);char creator_info[32 ] = {};size_t resident_size; -u32 gem_usage_flags = bo->debugfs.flags & (u32 )~PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED ; +u32 gem_usage_flags = bo->debugfs.flags;u32 gem_state_flags =0 ;/* Skip BOs being destroyed. */
@@ -436,8 +436,7 @@ void panthor_gem_debugfs_print_bos(struct panthor_device *ptdev, scoped_guard(mutex, &ptdev->gems.lock) {list_for_each_entry (bo, &ptdev->gems.node, debugfs.node) { -if (bo->debugfs.flags &PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED ) -panthor_gem_debugfs_bo_print (bo, m, &totals); +panthor_gem_debugfs_bo_print (bo, m, &totals); } }
drivers/gpu/drm/panthor/panthor_gem.h +0 -3
@@ -35,9 +35,6 @@ enum panthor_debugfs_gem_usage_flags {/** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED: BO is mapped on the FW VM. */ PANTHOR_DEBUGFS_GEM_USAGE_FLAG_FW_MAPPED = BIT(PANTHOR_DEBUGFS_GEM_USAGE_FW_MAPPED_BIT), - -/** @PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED: BO is ready for DebugFS display. */ - PANTHOR_DEBUGFS_GEM_USAGE_FLAG_INITIALIZED = BIT(31), };/**
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 204/627 wifi: ath12k: update unsupported bandwidth flags in reg rules
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harshitha Prem <[email protected]>
[ Upstream commit 2109e98503bc1c01c399feac68cc8b7faf6d0a4a ]
The maximum bandwidth an interface can operate in is defined by the configured country. However, currently, it is able to operate in bandwidths greater than the allowed bandwidth. For example, the Central African Republic (CF) supports a maximum bandwidth of 40 MHz in both the 2 GHz and 5 GHz bands, but an interface is still able to operate in bandwidths higher than 40 MHz. This issue arises because the regulatory rules in the regd are not updated with these restrictions received from firmware on the maximum bandwidth.
Hence, update the regulatory rules with unsupported bandwidth flags based on the maximum bandwidth to ensure compliance with country-specific regulations.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/reg.c | 31 ++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/reg.c +28 -3
@@ -398,6 +398,29 @@ ath12k_map_fw_dfs_region(enum ath12k_dfs_region dfs_region) } } +static u32 ath12k_get_bw_reg_flags (u16 max_bw) +{ +switch (max_bw) { +case 20 : +return NL80211_RRF_NO_HT40 | +NL80211_RRF_NO_80MHZ | +NL80211_RRF_NO_160MHZ | +NL80211_RRF_NO_320MHZ ; +case 40 : +return NL80211_RRF_NO_80MHZ | +NL80211_RRF_NO_160MHZ | +NL80211_RRF_NO_320MHZ ; +case 80 : +return NL80211_RRF_NO_160MHZ | +NL80211_RRF_NO_320MHZ ; +case 160 : +return NL80211_RRF_NO_320MHZ ; +case 320 : +default : +return 0 ; + } +} +static u32 ath12k_map_fw_reg_flags (u16 reg_flags) {u32 flags =0 ;
@@ -676,7 +699,7 @@ ath12k_reg_build_regd(struct ath12k_base *ab, reg_rule = reg_info->reg_rules_2g_ptr + i; max_bw =min_t (u16, reg_rule->max_bw, reg_info->max_bw_2g); - flags =0 ; + flags =ath12k_get_bw_reg_flags (reg_info->max_bw_2g);ath12k_reg_update_freq_range (&ab->reg_freq_2ghz, reg_rule); }else if (reg_info->num_5g_reg_rules && (j < reg_info->num_5g_reg_rules)) {
@@ -690,13 +713,15 @@ ath12k_reg_build_regd(struct ath12k_base *ab,* BW correction if required and applies flags as * per other BW rule flags we pass from here */ - flags =NL80211_RRF_AUTO_BW ; + flags =NL80211_RRF_AUTO_BW | +ath12k_get_bw_reg_flags (reg_info->max_bw_5g);ath12k_reg_update_freq_range (&ab->reg_freq_5ghz, reg_rule); }else if (reg_info->is_ext_reg_event && reg_6ghz_number && (k < reg_6ghz_number)) { reg_rule = reg_rule_6ghz + k++; max_bw =min_t (u16, reg_rule->max_bw, max_bw_6ghz); - flags =NL80211_RRF_AUTO_BW ; + flags =NL80211_RRF_AUTO_BW | +ath12k_get_bw_reg_flags (max_bw_6ghz);if (reg_rule->psd_flag) flags |=NL80211_RRF_PSD ;ath12k_reg_update_freq_range (&ab->reg_freq_6ghz, reg_rule);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 205/627 wifi: ath12k: pack HTT pdev rate stats structs
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Johnson <[email protected]>
[ Upstream commit fee9b1f6691120182136edacf590f52d62d9de7f ]
In order to ensure the HTT DebugFS structs shared with firmware have matching alignment, the structs should be packed. Most of the structs are correctly packed, however the following are not:
ath12k_htt_tx_pdev_rate_stats_tlvath12k_htt_rx_pdev_rate_stats_tlvath12k_htt_rx_pdev_rate_ext_stats_tlv
So pack those structs.
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
--- drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/debugfs_htt_stats.h +3 -3
@@ -470,7 +470,7 @@ struct ath12k_htt_tx_pdev_rate_stats_tlv { [ATH12K_HTT_TX_PDEV_STATS_NUM_EXTRA_MCS_COUNTERS ];__le32 tx_mcs_ext_2[ATH12K_HTT_TX_PDEV_STATS_NUM_EXTRA2_MCS_COUNTERS ];__le32 tx_bw_320mhz; -}; +} __packed;#define ATH12K_HTT_RX_PDEV_STATS_NUM_LEGACY_CCK_STATS 4#define ATH12K_HTT_RX_PDEV_STATS_NUM_LEGACY_OFDM_STATS 8
@@ -550,7 +550,7 @@ struct ath12k_htt_rx_pdev_rate_stats_tlv {__le32 rx_ulofdma_non_data_nusers[ATH12K_HTT_RX_PDEV_MAX_OFDMA_NUM_USER ];__le32 rx_ulofdma_data_nusers[ATH12K_HTT_RX_PDEV_MAX_OFDMA_NUM_USER ];__le32 rx_mcs_ext[ATH12K_HTT_RX_PDEV_STATS_NUM_EXTRA_MCS_COUNTERS ]; -}; +} __packed;#define ATH12K_HTT_RX_PDEV_STATS_NUM_BW_EXT_COUNTERS 4#define ATH12K_HTT_RX_PDEV_STATS_NUM_MCS_COUNTERS_EXT 14
@@ -580,7 +580,7 @@ struct ath12k_htt_rx_pdev_rate_ext_stats_tlv {__le32 rx_gi_ext_2[ATH12K_HTT_RX_PDEV_STATS_NUM_GI_COUNTERS ] [ATH12K_HTT_RX_PDEV_STATS_NUM_EXTRA2_MCS_COUNTERS ];__le32 rx_su_punctured_mode[ATH12K_HTT_RX_PDEV_STATS_NUM_PUNCTURED_MODE_COUNTERS ]; -}; +} __packed;#define ATH12K_HTT_TX_PDEV_STATS_SCHED_PER_TXQ_MAC_ID GENMASK(7, 0)#define ATH12K_HTT_TX_PDEV_STATS_SCHED_PER_TXQ_ID GENMASK(15, 8)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 206/627 arch: powerpc: defconfig: Drop obsolete CONFIG_NET_CLS_TCINDEX
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Korsnes <[email protected]>
[ Upstream commit 75cd37c5f28b85979fd5a65174013010f6b78f27 ]
This option was removed from the Kconfig in commit 8c710f75256b ("net/sched: Retire tcindex classifier") but it was not removed from the defconfigs.
--- arch/powerpc/configs/ppc6xx_defconfig | 1 - 1 file changed, 1 deletion(-)
arch/powerpc/configs/ppc6xx_defconfig +0 -1
@@ -252,7 +252,6 @@ CONFIG_NET_SCH_DSMARK=m CONFIG_NET_SCH_NETEM=m CONFIG_NET_SCH_INGRESS=m CONFIG_NET_CLS_BASIC=m -CONFIG_NET_CLS_TCINDEX=m CONFIG_NET_CLS_ROUTE4=m CONFIG_NET_CLS_FW=m CONFIG_NET_CLS_U32=m
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 207/627 um: rtc: Avoid shadowing err in uml_rtc_start()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 4c916e3b224a02019b3cc3983a15f32bfd9a22df ]
Remove the declaration of 'err' inside the 'if (timetravel)' block, as it would otherwise be unavailable outside that block, potentially leading to uml_rtc_start() returning an uninitialized value.
--- arch/um/drivers/rtc_user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/rtc_user.c +1 -1
@@ -28,7 +28,7 @@ int uml_rtc_start(bool timetravel)int err;if (timetravel) { -int err =os_pipe (uml_rtc_irq_fds,1 ,1 ); + err =os_pipe (uml_rtc_irq_fds,1 ,1 );if (err) goto fail; }else {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 208/627 iommu/amd: Enable PASID and ATS capabilities in the correct order
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Easwar Hariharan <[email protected]>
[ Upstream commit c694bc8b612ddd0dd70e122a00f39cb1e2e6927f ]
Per the PCIe spec, behavior of the PASID capability is undefined if the value of the PASID Enable bit changes while the Enable bit of the function's ATS control register is Set. Unfortunately, pdev_enable_caps() does exactly that by ordering enabling ATS for the device before enabling PASID.
--- drivers/iommu/amd/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/iommu.c +1 -1
@@ -634,8 +634,8 @@ static inline void pdev_disable_cap_pasid(struct pci_dev *pdev)static void pdev_enable_caps (struct pci_dev *pdev) { -pdev_enable_cap_ats (pdev);pdev_enable_cap_pasid (pdev); +pdev_enable_cap_ats (pdev);pdev_enable_cap_pri (pdev); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 209/627 spi: spi-nxp-fspi: Check return value of devm_mutex_init()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit d24a54e032021cf381af3c3cf119cc5cf6b3c1be ]
devm_mutex_init() can fail. With CONFIG_DEBUG_MUTEXES=y the mutex will be marked as unusable and trigger errors on usage.
Add the missed check.
--- drivers/spi/spi-nxp-fspi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-nxp-fspi.c +3 -1
@@ -1273,7 +1273,9 @@ static int nxp_fspi_probe(struct platform_device *pdev)if (ret)return dev_err_probe (dev, ret,"Failed to request irq\n" ); -devm_mutex_init (dev, &f->lock); + ret =devm_mutex_init (dev, &f->lock); +if (ret) +return dev_err_probe (dev, ret,"Failed to initialize lock\n" ); ctlr->bus_num =-1 ; ctlr->num_chipselect =NXP_FSPI_MAX_CHIPSELECT ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 210/627 leds: lp8860: Check return value of devm_mutex_init()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
[ Upstream commit 3b07bb900af7f43f13f9ff398b4c6ca1dee217cd ]
devm_mutex_init() can fail. With CONFIG_DEBUG_MUTEXES=y the mutex will be marked as unusable and trigger errors on usage.
Add the missed check.
--- drivers/leds/leds-lp8860.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-lp8860.c +3 -1
@@ -307,7 +307,9 @@ static int lp8860_probe(struct i2c_client *client) led->client = client; led->led_dev.brightness_set_blocking = lp8860_brightness_set; -devm_mutex_init (&client->dev, &led->lock); + ret =devm_mutex_init (&client->dev, &led->lock); +if (ret) +return dev_err_probe (&client->dev, ret,"Failed to initialize lock\n" ); led->regmap =devm_regmap_init_i2c (client, &lp8860_regmap_config);if (IS_ERR (led->regmap)) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 211/627 net/sched: Restrict conditions for adding duplicating netems to qdisc tree
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: William Liu <[email protected]>
[ Upstream commit ec8e0e3d7adef940cdf9475e2352c0680189d14e ]
netem_enqueue's duplication prevention logic breaks when a netem resides in a qdisc tree with other netems - this can lead to a soft lockup and OOM loop in netem_dequeue, as seen in [1]. Ensure that a duplicating netem cannot exist in a tree with other netems.
Previous approaches suggested in discussions in chronological order:
1) Track duplication status or ttl in the sk_buff struct. Considered too specific a use case to extend such a struct, though this would be a resilient fix and address other previous and potential future DOS bugs like the one described in loopy fun [2].
2) Restrict netem_enqueue recursion depth like in act_mirred with a per cpu variable. However, netem_dequeue can call enqueue on its child, and the depth restriction could be bypassed if the child is a netem.
3) Use the same approach as in 2, but add metadata in netem_skb_cb to handle the netem_dequeue case and track a packet's involvement in duplication. This is an overly complex approach, and Jamal notes that the skb cb can be overwritten to circumvent this safeguard.
4) Prevent the addition of a netem to a qdisc tree if its ancestral path contains a netem. However, filters and actions can cause a packet to change paths when re-enqueued to the root from netem duplication, leading us to the current solution: prevent a duplicating netem from inhabiting the same tree as other netems.
[1] https://lore.kernel.org/netdev/8DuRWwfqjoRDLDmBMlIfbrsZg9Gx50DHJc1ilxsEBNe2D6NMoigR_eIRIG0LOjMc3r10nUUZtArXx4oZBIdUfZQrwjcQhdinnMis_0G7VEk=@willsroot.io/
[2] https://lwn.net/Articles/719297/
--- net/sched/sch_netem.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
net/sched/sch_netem.c +40 -0
@@ -973,6 +973,41 @@ static int parse_attr(struct nlattr *tb[], int maxtype, struct nlattr *nla,return 0 ; } +static const struct Qdisc_class_ops netem_class_ops; + +static int check_netem_in_tree (struct Qdisc *sch,bool duplicates, +struct netlink_ext_ack *extack) +{ +struct Qdisc *root, *q; +unsigned int i; + + root =qdisc_root_sleeping (sch); + +if (sch != root && root->ops->cl_ops == &netem_class_ops) { +if (duplicates || + ((struct netem_sched_data *)qdisc_priv (root))->duplicate) + goto err; + } + +if (!qdisc_dev (root)) +return 0 ; + +hash_for_each (qdisc_dev (root)->qdisc_hash, i, q, hash) { +if (sch != q && q->ops->cl_ops == &netem_class_ops) { +if (duplicates || + ((struct netem_sched_data *)qdisc_priv (q))->duplicate) + goto err; + } + } + +return 0 ; + +err: +NL_SET_ERR_MSG (extack, +"netem: cannot mix duplicating netems with other netems in tree" ); +return -EINVAL ; +} +/* Parse netlink message to set options */ static int netem_change (struct Qdisc *sch,struct nlattr *opt,struct netlink_ext_ack *extack)
@@ -1031,6 +1066,11 @@ static int netem_change(struct Qdisc *sch, struct nlattr *opt, q->gap = qopt->gap; q->counter =0 ; q->loss = qopt->loss; + + ret =check_netem_in_tree (sch, qopt->duplicate, extack); +if (ret) + goto unlock; + q->duplicate = qopt->duplicate;/* for compatibility with earlier versions.
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 212/627 net_sched: act_ctinfo: use atomic64_t for three counters
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d300335b4e18672913dd792ff9f49e6cccf41d26 ]
Commit 21c167aa0ba9 ("net/sched: act_ctinfo: use percpu stats") missed that stats_dscp_set, stats_dscp_error and stats_cpmark_set might be written (and read) locklessly.
Use atomic64_t for these three fields, I doubt act_ctinfo is used heavily on big SMP hosts anyway.
--- include/net/tc_act/tc_ctinfo.h | 6 +++--- net/sched/act_ctinfo.c | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-)
include/net/tc_act/tc_ctinfo.h +3 -3
@@ -18,9 +18,9 @@ struct tcf_ctinfo_params {struct tcf_ctinfo {struct tc_action common;struct tcf_ctinfo_params __rcu *params; -u64 stats_dscp_set; -u64 stats_dscp_error; -u64 stats_cpmark_set; +atomic64_t stats_dscp_set; +atomic64_t stats_dscp_error; +atomic64_t stats_cpmark_set; };enum {
net/sched/act_ctinfo.c +11 -8
@@ -44,9 +44,9 @@ static void tcf_ctinfo_dscp_set(struct nf_conn *ct, struct tcf_ctinfo *ca,ipv4_change_dsfield (ip_hdr (skb),INET_ECN_MASK , newdscp); - ca->stats_dscp_set++; +atomic64_inc (&ca->stats_dscp_set); }else { - ca->stats_dscp_error++; +atomic64_inc (&ca->stats_dscp_error); } }break ;
@@ -57,9 +57,9 @@ static void tcf_ctinfo_dscp_set(struct nf_conn *ct, struct tcf_ctinfo *ca,ipv6_change_dsfield (ipv6_hdr (skb),INET_ECN_MASK , newdscp); - ca->stats_dscp_set++; +atomic64_inc (&ca->stats_dscp_set); }else { - ca->stats_dscp_error++; +atomic64_inc (&ca->stats_dscp_error); } }break ;
@@ -72,7 +72,7 @@ static void tcf_ctinfo_cpmark_set(struct nf_conn *ct, struct tcf_ctinfo *ca,struct tcf_ctinfo_params *cp, struct sk_buff *skb) { - ca->stats_cpmark_set++; + atomic64_inc(&ca->stats_cpmark_set); skb->mark =READ_ONCE (ct->mark) & cp->cpmarkmask; }
@@ -323,15 +323,18 @@ static int tcf_ctinfo_dump(struct sk_buff *skb, struct tc_action *a, }if (nla_put_u64_64bit (skb,TCA_CTINFO_STATS_DSCP_SET , - ci->stats_dscp_set,TCA_CTINFO_PAD )) +atomic64_read (&ci->stats_dscp_set), +TCA_CTINFO_PAD )) goto nla_put_failure;if (nla_put_u64_64bit (skb,TCA_CTINFO_STATS_DSCP_ERROR , - ci->stats_dscp_error,TCA_CTINFO_PAD )) +atomic64_read (&ci->stats_dscp_error), +TCA_CTINFO_PAD )) goto nla_put_failure;if (nla_put_u64_64bit (skb,TCA_CTINFO_STATS_CPMARK_SET , - ci->stats_cpmark_set,TCA_CTINFO_PAD )) +atomic64_read (&ci->stats_cpmark_set), +TCA_CTINFO_PAD )) goto nla_put_failure;spin_unlock_bh (&ci->tcf_lock);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 213/627 RDMA/mlx5: Fix UMR modifying of mkey page size
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edward Srouji <[email protected]>
[ Upstream commit c4f96972c3c206ac8f6770b5ecd5320b561d0058 ]
When changing the page size on an mkey, the driver needs to set the appropriate bits in the mkey mask to indicate which fields are being modified.
The 6th bit of a page size in mlx5 driver is considered an extension, and this bit has a dedicated capability and mask bits.
Previously, the driver was not setting this mask in the mkey mask when performing page size changes, regardless of its hardware support, potentially leading to an incorrect page size updates.
This fixes the issue by setting the relevant bit in the mkey mask when performing page size changes on an mkey and the 6th bit of this field is supported by the hardware.
--- drivers/infiniband/hw/mlx5/umr.c | 6 ++++-- include/linux/mlx5/device.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx5/umr.c +4 -2
@@ -32,13 +32,15 @@ static __be64 get_umr_disable_mr_mask(void)return cpu_to_be64 (result); } -static __be64 get_umr_update_translation_mask (void ) +static __be64 get_umr_update_translation_mask (struct mlx5_ib_dev *dev) {u64 result; result =MLX5_MKEY_MASK_LEN |MLX5_MKEY_MASK_PAGE_SIZE |MLX5_MKEY_MASK_START_ADDR ; +if (MLX5_CAP_GEN_2 (dev->mdev, umr_log_entity_size_5)) + result |=MLX5_MKEY_MASK_PAGE_SIZE_5 ;return cpu_to_be64 (result); }
@@ -654,7 +656,7 @@ static void mlx5r_umr_final_update_xlt(struct mlx5_ib_dev *dev, flags &MLX5_IB_UPD_XLT_ENABLE || flags &MLX5_IB_UPD_XLT_ADDR ;if (update_translation) { - wqe->ctrl_seg.mkey_mask |=get_umr_update_translation_mask (); + wqe->ctrl_seg.mkey_mask |=get_umr_update_translation_mask (dev);if (!mr->ibmr.length)MLX5_SET (mkc, &wqe->mkey_seg, length64,1 ); }
include/linux/mlx5/device.h +1 -0
@@ -280,6 +280,7 @@ enum {MLX5_MKEY_MASK_SMALL_FENCE =1ull <<23 ,MLX5_MKEY_MASK_RELAXED_ORDERING_WRITE =1ull <<25 ,MLX5_MKEY_MASK_FREE =1ull <<29 , +MLX5_MKEY_MASK_PAGE_SIZE_5 =1ull <<42 , MLX5_MKEY_MASK_RELAXED_ORDERING_READ = 1ull << 47, };
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 214/627 xen: fix UAF in dmabuf_exp_from_pages()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
[ Upstream commit 532c8b51b3a8676cbf533a291f8156774f30ea87 ]
[dma_buf_fd() fixes; no preferences regarding the tree it goes through - up to xen folks]
As soon as we'd inserted a file reference into descriptor table, another thread could close it. That's fine for the case when all we are doing is returning that descriptor to userland (it's a race, but it's a userland race and there's nothing the kernel can do about it). However, if we follow fd_install() with any kind of access to objects that would be destroyed on close (be it the struct file itself or anything destroyed by its ->release()), we have a UAF.
dma_buf_fd() is a combination of reserving a descriptor and fd_install(). gntdev dmabuf_exp_from_pages() calls it and then proceeds to access the objects destroyed on close - starting with gntdev_dmabuf itself.
Fix that by doing reserving descriptor before anything else and do fd_install() only when everything had been set up.
Message-ID: <20250712050916.GY1880847@ZenIV>
--- drivers/xen/gntdev-dmabuf.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-)
drivers/xen/gntdev-dmabuf.c +10 -18
@@ -357,8 +357,11 @@ struct gntdev_dmabuf_export_args {static int dmabuf_exp_from_pages (struct gntdev_dmabuf_export_args *args) {DEFINE_DMA_BUF_EXPORT_INFO (exp_info); -struct gntdev_dmabuf *gntdev_dmabuf; -int ret; + struct gntdev_dmabuf *gntdev_dmabuf __free(kfree) = NULL; +CLASS (get_unused_fd, ret)(O_CLOEXEC ); + +if (ret <0 ) +return ret; gntdev_dmabuf =kzalloc (sizeof (*gntdev_dmabuf),GFP_KERNEL );if (!gntdev_dmabuf)
@@ -383,32 +386,21 @@ static int dmabuf_exp_from_pages(struct gntdev_dmabuf_export_args *args) exp_info.priv = gntdev_dmabuf; gntdev_dmabuf->dmabuf =dma_buf_export (&exp_info); -if (IS_ERR (gntdev_dmabuf->dmabuf)) { - ret =PTR_ERR (gntdev_dmabuf->dmabuf); - gntdev_dmabuf->dmabuf =NULL ; - goto fail; - } - - ret =dma_buf_fd (gntdev_dmabuf->dmabuf,O_CLOEXEC ); -if (ret <0 ) - goto fail; +if (IS_ERR (gntdev_dmabuf->dmabuf)) +return PTR_ERR (gntdev_dmabuf->dmabuf); gntdev_dmabuf->fd = ret; args->fd = ret;pr_debug ("Exporting DMA buffer with fd %d\n" , ret); +get_file (gntdev_dmabuf->priv->filp);mutex_lock (&args->dmabuf_priv->lock);list_add (&gntdev_dmabuf->next, &args->dmabuf_priv->exp_list);mutex_unlock (&args->dmabuf_priv->lock); -get_file (gntdev_dmabuf->priv->filp); -return 0 ; -fail: -if (gntdev_dmabuf->dmabuf) -dma_buf_put (gntdev_dmabuf->dmabuf); -kfree (gntdev_dmabuf); -return ret; +fd_install (take_fd (ret),no_free_ptr (gntdev_dmabuf)->dmabuf->file); +return 0 ; } static struct gntdev_grant_map *
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 215/627 sched/deadline: Initialize dl_servers after SMP
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
[ Upstream commit 9f239df55546ee1d28f0976130136ffd1cad0fd7 ]
dl-servers are currently initialized too early at boot when CPUs are not fully up (only boot CPU is). This results in miscalculation of per runqueue DEADLINE variables like extra_bw (which needs a stable CPU count).
Move initialization of dl-servers later on after SMP has been initialized and CPUs are all online, so that CPU count is stable and DEADLINE variables can be computed correctly.
--- kernel/sched/core.c | 2 ++ kernel/sched/deadline.c | 48 +++++++++++++++++++++++++---------------- kernel/sched/sched.h | 1 + 3 files changed, 33 insertions(+), 18 deletions(-)
kernel/sched/core.c +2 -0
@@ -8470,6 +8470,8 @@ void __init sched_init_smp(void)init_sched_rt_class ();init_sched_dl_class (); +sched_init_dl_servers (); + sched_smp_initialized = true; }
kernel/sched/deadline.c +30 -18
72 lines not on this page · raw message
kernel/sched/sched.h +1 -0
@@ -384,6 +384,7 @@ extern void dl_server_stop(struct sched_dl_entity *dl_se);extern void dl_server_init (struct sched_dl_entity *dl_se,struct rq *rq,dl_server_has_tasks_f has_tasks,dl_server_pick_f pick_task); +extern void sched_init_dl_servers (void );extern void dl_server_update_idle_time (struct rq *rq,struct task_struct *p);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 216/627 sched/deadline: Reset extra_bw to max_bw when clearing root domains
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juri Lelli <[email protected]>
[ Upstream commit fcc9276c4d331cd1fe9319d793e80b02e09727f5 ]
dl_clear_root_domain() doesn't take into account the fact that per-rq extra_bw variables retain values computed before root domain changes, resulting in broken accounting.
Fix it by resetting extra_bw to max_bw before restoring back dl-servers contributions.
--- kernel/sched/deadline.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/sched/deadline.c +7 -0
@@ -3007,7 +3007,14 @@ void dl_clear_root_domain(struct root_domain *rd)int i;guard (raw_spinlock_irqsave)(&rd->dl_bw.lock); + +/* +* Reset total_bw to zero and extra_bw to max_bw so that next +* loop will add dl-servers contributions back properly, +*/ rd->dl_bw.total_bw =0 ; +for_each_cpu (i, rd->span) +cpu_rq (i)->dl.extra_bw =cpu_rq (i)->dl.max_bw;/* * dl_servers are not tasks. Since dl_add_task_root_domain ignores
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 217/627 iommu/vt-d: Do not wipe out the page table NID when devices detach
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 5c3687d5789cfff8d285a2c76bceb47f145bf01f ]
The NID is used to control which NUMA node memory for the page table is allocated it from. It should be a permanent property of the page table when it was allocated and not change during attach/detach of devices.
--- drivers/iommu/intel/iommu.c | 1 - 1 file changed, 1 deletion(-)
drivers/iommu/intel/iommu.c +0 -1
@@ -1391,7 +1391,6 @@ void domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu)if (--info->refcnt ==0 ) {ida_free (&iommu->domain_ida, info->did);xa_erase (&domain->iommu_array, iommu->seq_id); - domain->nid =NUMA_NO_NODE ;kfree (info); } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 218/627 iommu/vt-d: Fix missing PASID in dev TLB flush with cache_tag_flush_all
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ethan Milon <[email protected]>
[ Upstream commit 3141153816bf4f0257747bd4dda176d38f1a9a49 ]
The function cache_tag_flush_all() was originally implemented with incorrect device TLB invalidation logic that does not handle PASID, in commit c4d27ffaa8eb ("iommu/vt-d: Add cache tag invalidation helpers")
This causes regressions where full address space TLB invalidations occur with a PASID attached, such as during transparent hugepage unmapping in SVA configurations or when calling iommu_flush_iotlb_all(). In these cases, the device receives a TLB invalidation that lacks PASID.
This incorrect logic was later extracted into cache_tag_flush_devtlb_all(), in commit 3297d047cd7f ("iommu/vt-d:
Refactor IOTLB and Dev-IOTLB flush for batching")
The fix replaces the call to cache_tag_flush_devtlb_all() with cache_tag_flush_devtlb_psi(), which properly handles PASID.
--- drivers/iommu/intel/cache.c | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/iommu/intel/cache.c +1 -17
@@ -422,22 +422,6 @@ static void cache_tag_flush_devtlb_psi(struct dmar_domain *domain, struct cache_ domain->qi_batch); } -static void cache_tag_flush_devtlb_all (struct dmar_domain *domain,struct cache_tag *tag) -{ -struct intel_iommu *iommu = tag->iommu; -struct device_domain_info *info; -u16 sid; - - info =dev_iommu_priv_get (tag->dev); - sid =PCI_DEVID (info->bus, info->devfn); - -qi_batch_add_dev_iotlb (iommu, sid, info->pfsid, info->ats_qdep,0 , -MAX_AGAW_PFN_WIDTH , domain->qi_batch); -if (info->dtlb_extra_inval) -qi_batch_add_dev_iotlb (iommu, sid, info->pfsid, info->ats_qdep,0 , -MAX_AGAW_PFN_WIDTH , domain->qi_batch); -} -/* * Invalidates a range of IOVA from @start (inclusive) to @end (inclusive) * when the memory mappings in the target domain have been modified.
@@ -508,7 +492,7 @@ void cache_tag_flush_all(struct dmar_domain *domain)break ;case CACHE_TAG_DEVTLB :case CACHE_TAG_NESTING_DEVTLB : -cache_tag_flush_devtlb_all (domain, tag); +cache_tag_flush_devtlb_psi (domain, tag,0 ,MAX_AGAW_PFN_WIDTH );break ; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 219/627 iommu/arm-smmu: disable PRR on SM8250
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit b9bb7e814cd0c3633791327a96749a1f9b7f3ef4 ]
On SM8250 / QRB5165-RB5 using PRR bits resets the device, most likely because of the hyp limitations. Disable PRR support on that platform.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +2 -1
@@ -355,7 +355,8 @@ static int qcom_adreno_smmu_init_context(struct arm_smmu_domain *smmu_domain, priv->set_prr_addr =NULL ;if (of_device_is_compatible (np,"qcom,smmu-500" ) && -of_device_is_compatible (np,"qcom,adreno-smmu" )) { + !of_device_is_compatible (np,"qcom,sm8250-smmu-500" ) && +of_device_is_compatible (np,"qcom,adreno-smmu" )) { priv->set_prr_bit = qcom_adreno_smmu_set_prr_bit; priv->set_prr_addr = qcom_adreno_smmu_set_prr_addr; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 220/627 xen/gntdev: remove struct gntdev_copy_batch from stack
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 70045cf6593cbf0740956ea9b7b4269142c6ee38 ]
When compiling the kernel with LLVM, the following warning was issued:
drivers/xen/gntdev.c:991: warning: stack frame size (1160) exceeds limit (1024) in function 'gntdev_ioctl'
The main reason is struct gntdev_copy_batch which is located on the stack and has a size of nearly 1kb.
For performance reasons it shouldn't by just dynamically allocated instead, so allocate a new instance when needed and instead of freeing it put it into a list of free structs anchored in struct gntdev_priv.
Message-ID: <[email protected]>
--- drivers/xen/gntdev-common.h | 4 +++ drivers/xen/gntdev.c | 71 ++++++++++++++++++++++++++----------- 2 files changed, 54 insertions(+), 21 deletions(-)
drivers/xen/gntdev-common.h +4 -0
@@ -26,6 +26,10 @@ struct gntdev_priv {/* lock protects maps and freeable_maps. */ struct mutex lock; +/* Free instances of struct gntdev_copy_batch. */ +struct gntdev_copy_batch *batch; +struct mutex batch_lock; +#ifdef CONFIG_XEN_GRANT_DMA_ALLOC /* Device for which DMA memory is allocated. */ struct device *dma_dev;
drivers/xen/gntdev.c +50 -21
127 lines not on this page · raw message
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 221/627 tcp: call tcp_measure_rcv_mss() for ooo packets
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 38d7e444336567bae1c7b21fc18b7ceaaa5643a0 ]
tcp_measure_rcv_mss() is used to update icsk->icsk_ack.rcv_mss (tcpi_rcv_mss in tcp_info) and tp->scaling_ratio.
Calling it from tcp_data_queue_ofo() makes sure these fields are updated, and permits a better tuning of sk->sk_rcvbuf, in the case a new flow receives many ooo packets.
--- net/ipv4/tcp_input.c | 1 + 1 file changed, 1 insertion(+)
net/ipv4/tcp_input.c +1 -0
@@ -5055,6 +5055,7 @@ static void tcp_data_queue_ofo(struct sock *sk, struct sk_buff *skb)return ; } +tcp_measure_rcv_mss (sk, skb);/* Disable header prediction. */ tp->pred_flags =0 ;inet_csk_schedule_ack (sk);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 222/627 wifi: rtl8xxxu: Fix RX skb size for aggregation disabled
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kaistra <[email protected]>
[ Upstream commit d76a1abcf57734d2bcd4a7ec051617edd4513d7f ]
Commit 1e5b3b3fe9e0 ("rtl8xxxu: Adjust RX skb size to include space for phystats") increased the skb size when aggregation is enabled but decreased it for the aggregation disabled case.
As a result, if a frame near the maximum size is received, rtl8xxxu_rx_complete() is called with status -EOVERFLOW and then the driver starts to malfunction and no further communication is possible.
Restore the skb size in the aggregation disabled case.
--- drivers/net/wireless/realtek/rtl8xxxu/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/core.c +1 -1
@@ -6617,7 +6617,7 @@ static int rtl8xxxu_submit_rx_urb(struct rtl8xxxu_priv *priv, skb_size = fops->rx_agg_buf_size; skb_size += (rx_desc_sz +sizeof (struct rtl8723au_phy_stats )); }else { - skb_size =IEEE80211_MAX_FRAME_LEN ; + skb_size =IEEE80211_MAX_FRAME_LEN + rx_desc_sz; } skb =__netdev_alloc_skb (NULL , skb_size,GFP_KERNEL );
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 223/627 wifi: rtw88: Fix macid assigned to TDLS station
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
[ Upstream commit 526b000991b557c40ea53e64ba24bb9e0fff0071 ]
When working in station mode, TDLS peers are assigned macid 0, even though 0 was already assigned to the AP. This causes the connection with the AP to stop working after the TDLS connection is torn down.
Assign the next available macid to TDLS peers, same as client stations in AP mode.
--- drivers/net/wireless/realtek/rtw88/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +2 -2
@@ -349,7 +349,7 @@ int rtw_sta_add(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,struct rtw_vif *rtwvif = (struct rtw_vif *)vif->drv_priv;int i; -if (vif->type ==NL80211_IFTYPE_STATION ) { +if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls) { si->mac_id = rtwvif->mac_id; }else { si->mac_id =rtw_acquire_macid (rtwdev);
@@ -386,7 +386,7 @@ void rtw_sta_remove(struct rtw_dev *rtwdev, struct ieee80211_sta *sta,cancel_work_sync (&si->rc_work); -if (vif->type !=NL80211_IFTYPE_STATION ) +if (vif->type !=NL80211_IFTYPE_STATION || sta->tdls)rtw_release_macid (rtwdev, si->mac_id);if (fw_exist)rtw_fw_media_status_report (rtwdev, si->mac_id, false);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 224/627 mwl8k: Add missing check after DMA map
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Fourier <[email protected]>
[ Upstream commit 50459501b9a212dbe7a673727589ee105a8a9954 ]
The DMA map functions can fail and should be tested for errors. If the mapping fails, unmap and return an error.
--- drivers/net/wireless/marvell/mwl8k.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/marvell/mwl8k.c +4 -0
@@ -1227,6 +1227,10 @@ static int rxq_refill(struct ieee80211_hw *hw, int index, int limit) addr =dma_map_single (&priv->pdev->dev, skb->data,MWL8K_RX_MAXSZ ,DMA_FROM_DEVICE ); +if (dma_mapping_error (&priv->pdev->dev, addr)) { +kfree_skb (skb); +break ; + } rxq->rxd_count++; rx = rxq->tail++;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 225/627 wifi: mac80211: use RCU-safe iteration in ieee80211_csa_finish
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maharaja Kennadyrajan <[email protected]>
[ Upstream commit 9975aeebe2908cdd552ee59607754755459fad52 ]
The ieee80211_csa_finish() function currently uses for_each_sdata_link() to iterate over links of sdata. However, this macro internally uses wiphy_dereference(), which expects the wiphy->mtx lock to be held. When ieee80211_csa_finish() is invoked under an RCU read-side critical section (e.g., under rcu_read_lock()), this leads to a warning from the RCU debugging framework.
WARNING: suspicious RCU usage
net/mac80211/cfg.c:3830 suspicious rcu_dereference_protected() usage!
This warning is triggered because wiphy_dereference() is not safe to use without holding the wiphy mutex, and it is being used in an RCU context without the required locking.
Fix this by introducing and using a new macro, for_each_sdata_link_rcu(), which performs RCU-safe iteration over sdata links using list_for_each_entry_rcu() and rcu_dereference(). This ensures that the link pointers are accessed safely under RCU and eliminates the warning.
--- net/mac80211/cfg.c | 2 +- net/mac80211/ieee80211_i.h | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +1 -1
@@ -3760,7 +3760,7 @@ void ieee80211_csa_finish(struct ieee80211_vif *vif, unsigned int link_id)*/ struct ieee80211_link_data *iter; -for_each_sdata_link (local, iter) { +for_each_sdata_link_rcu (local, iter) {if (iter->sdata == sdata ||rcu_access_pointer (iter->conf->tx_bss_conf) != tx_bss_conf)continue ;
net/mac80211/ieee80211_i.h +15 -0
@@ -1226,6 +1226,21 @@ struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)if ((_link =wiphy_dereference ((_local)->hw.wiphy, \ ___sdata->link[___link_id]))) +/* +* for_each_sdata_link_rcu() must be used under RCU read lock. + */ +#define for_each_sdata_link_rcu(_local, _link) \ + /* outer loop just to define the variables ... */ \ + for (struct ieee80211_sub_if_data *___sdata = NULL; \ + !___sdata; \ + ___sdata = (void *)~0 /* always stop */) \ + list_for_each_entry_rcu(___sdata, &(_local)->interfaces, list) \ + if (ieee80211_sdata_running(___sdata)) \ + for (int ___link_id = 0; \ + ___link_id < ARRAY_SIZE((___sdata)->link); \ + ___link_id++) \ + if ((_link = rcu_dereference((___sdata)->link[___link_id]))) +#define for_each_link_data (sdata, __link) \ struct ieee80211_sub_if_data *__sdata = sdata; \ for (int __link_id = 0; \
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 226/627 wifi: ath12k: Use HTT_TCL_METADATA_VER_V1 in FTM mode
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaradhana Sahu <[email protected]>
[ Upstream commit 66b3ebc77d23d6574a965bdbfe41de8aeb7f384e ]
Currently host sends HTT_TCL_METADATA_VER_V2 to the firmware regardless of the operating mode (Mission or FTM).
Firmware expects additional software information (like peer ID, vdev ID, and link ID) in Tx packets when HTT_TCL_METADATA_VER_V2 is set. However, in FTM (Factory Test Mode) mode, no vdev is created on the host side (this is expected). As a result, the firmware fails to find the expected vdev during packet processing and ends up dropping packets.
To fix this, send HTT_TCL_METADATA_VER_V1 in FTM mode because FTM mode doesn't support HTT_TCL_METADATA_VER_V2.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath12k/dp.h | 1 + drivers/net/wireless/ath/ath12k/dp_tx.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/net/wireless/ath/ath12k/dp.h +1 -0
@@ -469,6 +469,7 @@ enum htt_h2t_msg_type { };#define HTT_VER_REQ_INFO_MSG_ID GENMASK(7, 0) +#define HTT_OPTION_TCL_METADATA_VER_V1 1#define HTT_OPTION_TCL_METADATA_VER_V2 2#define HTT_OPTION_TAG GENMASK(7, 0)#define HTT_OPTION_LEN GENMASK(15, 8)
drivers/net/wireless/ath/ath12k/dp_tx.c +4 -1
@@ -1182,6 +1182,7 @@ int ath12k_dp_tx_htt_h2t_ver_req_msg(struct ath12k_base *ab)struct sk_buff *skb;struct htt_ver_req_cmd *cmd;int len =sizeof (*cmd); +u32 metadata_version;int ret;init_completion (&dp->htt_tgt_version_received);
@@ -1194,12 +1195,14 @@ int ath12k_dp_tx_htt_h2t_ver_req_msg(struct ath12k_base *ab) cmd = (struct htt_ver_req_cmd *)skb->data; cmd->ver_reg_info =le32_encode_bits (HTT_H2T_MSG_TYPE_VERSION_REQ ,HTT_OPTION_TAG ); + metadata_version = ath12k_ftm_mode ?HTT_OPTION_TCL_METADATA_VER_V1 : +HTT_OPTION_TCL_METADATA_VER_V2 ; cmd->tcl_metadata_version =le32_encode_bits (HTT_TAG_TCL_METADATA_VERSION ,HTT_OPTION_TAG ) |le32_encode_bits (HTT_TCL_METADATA_VER_SZ ,HTT_OPTION_LEN ) | -le32_encode_bits (HTT_OPTION_TCL_METADATA_VER_V2 , +le32_encode_bits (metadata_version,HTT_OPTION_VALUE ); ret =ath12k_htc_send (&ab->htc, dp->eid, skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 227/627 wifi: ath11k: fix sleeping-in-atomic in ath11k_mac_op_set_bitrate_mask()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Baochen Qiang <[email protected]>
[ Upstream commit 65c12b104cb942d588a1a093acc4537fb3d3b129 ]
ath11k_mac_disable_peer_fixed_rate() is passed as the iterator to ieee80211_iterate_stations_atomic(). Note in this case the iterator is required to be atomic, however ath11k_mac_disable_peer_fixed_rate() does not follow it as it might sleep. Consequently below warning is seen:
BUG: sleeping function called from invalid context at wmi.c:304 Call Trace: <TASK> dump_stack_lvl __might_resched.cold ath11k_wmi_cmd_send ath11k_wmi_set_peer_param ath11k_mac_disable_peer_fixed_rate ieee80211_iterate_stations_atomic ath11k_mac_op_set_bitrate_mask.cold
Change to ieee80211_iterate_stations_mtx() to fix this issue.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.30
--- drivers/net/wireless/ath/ath11k/mac.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +6 -6
@@ -8740,9 +8740,9 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, arvif->vdev_id, ret);return ret; } -ieee80211_iterate_stations_atomic (ar->hw, - ath11k_mac_disable_peer_fixed_rate, - arvif); +ieee80211_iterate_stations_mtx (ar->hw, + ath11k_mac_disable_peer_fixed_rate, + arvif); }else if (ath11k_mac_bitrate_mask_get_single_nss (ar, arvif, band, mask, &single_nss)) { rate =WMI_FIXED_RATE_NONE ;
@@ -8809,9 +8809,9 @@ ath11k_mac_op_set_bitrate_mask(struct ieee80211_hw *hw, }mutex_lock (&ar->conf_mutex); -ieee80211_iterate_stations_atomic (ar->hw, - ath11k_mac_disable_peer_fixed_rate, - arvif); +ieee80211_iterate_stations_mtx (ar->hw, + ath11k_mac_disable_peer_fixed_rate, + arvif); arvif->bitrate_mask = *mask; ieee80211_iterate_stations_atomic(ar->hw,
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 228/627 drm/amdgpu/gfx9: fix kiq locking in KCQ reset
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 730ea5074dac1b105717316be5d9c18b09829385 ]
The ring test needs to be inside the lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1 -1
@@ -7280,8 +7280,8 @@ static int gfx_v9_0_reset_kcq(struct amdgpu_ring *ring, } kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r) {DRM_ERROR ("fail to remap queue\n" );return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 229/627 drm/amdgpu/gfx9.4.3: fix kiq locking in KCQ reset
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 08f116c59310728ea8b7e9dc3086569006c861cf ]
The ring test needs to be inside the lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +1 -2
@@ -3612,9 +3612,8 @@ static int gfx_v9_4_3_reset_kcq(struct amdgpu_ring *ring, } kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r) {dev_err (adev->dev,"fail to remap queue\n" );return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 230/627 drm/amdgpu/gfx10: fix kiq locking in KCQ reset
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit a4b2ba8f631d3e44b30b9b46ee290fbfe608b7d0 ]
The ring test needs to be inside the lock.
--- drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c +2 -4
@@ -9617,9 +9617,8 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring, kiq->pmf->kiq_unmap_queues (kiq_ring, ring,RESET_QUEUES ,0 ,0 );amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r)return r;
@@ -9655,9 +9654,8 @@ static int gfx_v10_0_reset_kcq(struct amdgpu_ring *ring, } kiq->pmf->kiq_map_queues (kiq_ring, ring);amdgpu_ring_commit (kiq_ring); -spin_unlock_irqrestore (&kiq->ring_lock, flags); - r =amdgpu_ring_test_ring (kiq_ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags);if (r)return r;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 231/627 selftests/bpf: fix implementation of smp_mb()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 0769857a07b4451a1dc1c3ad1f1c86a6f4ce136a ]
As BPF doesn't include any barrier instructions, smp_mb() is implemented by doing a dummy value returning atomic operation. Such an operation acts a full barrier as enforced by LKMM and also by the work in progress BPF memory model.
If the returned value is not used, clang[1] can optimize the value returning atomic instruction in to a normal atomic instruction which provides no ordering guarantees.
Mark the variable as volatile so the above optimization is never performed and smp_mb() works as expected.
[1] https://godbolt.org/z/qzze7bG6z
--- tools/testing/selftests/bpf/bpf_atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_atomic.h +1 -1
@@ -61,7 +61,7 @@ extern bool CONFIG_X86_64 __kconfig __weak;#define smp_mb () \ ({ \ - unsigned long __val; \ + volatile unsigned long __val; \ __sync_fetch_and_add(&__val, 0); \ })
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 232/627 iommu/amd: Fix geometry.aperture_end for V2 tables
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 8637afa79cfa6123f602408cfafe8c9a73620ff1 ]
The AMD IOMMU documentation seems pretty clear that the V2 table follows the normal CPU expectation of sign extension. This is shown in
Figure 25: AMD64 Long Mode 4-Kbyte Page Address Translation
Where bits Sign-Extend [63:57] == [56]. This is typical for x86 which would have three regions in the page table: lower, non-canonical, upper.
The manual describes that the V1 table does not sign extend in section 2.2.4 Sharing AMD64 Processor and IOMMU Page Tables GPA-to-SPA
Further, Vasant has checked this and indicates the HW has an addtional behavior that the manual does not yet describe. The AMDv2 table does not have the sign extended behavior when attached to PASID 0, which may explain why this has gone unnoticed.
The iommu domain geometry does not directly support sign extended page tables. The driver should report only one of the lower/upper spaces. Solve this by removing the top VA bit from the geometry to use only the lower space.
This will also make the iommu_domain work consistently on all PASID 0 and PASID != 1.
Adjust dma_max_address() to remove the top VA bit. It now returns:
5 Level:
Before 0x1ffffffffffffff
After 0x0ffffffffffffff
4 Level:
Before 0xffffffffffff
After 0x7fffffffffff
--- drivers/iommu/amd/iommu.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/iommu/amd/iommu.c +15 -2
@@ -2526,8 +2526,21 @@ static inline u64 dma_max_address(enum protection_domain_mode pgtable)if (pgtable ==PD_MODE_V1 )return ~0ULL ; -/* V2 with 4/5 level page table */ -return ((1ULL <<PM_LEVEL_SHIFT (amd_iommu_gpt_level)) -1 ); +/* +* V2 with 4/5 level page table. Note that "2.2.6.5 AMD64 4-Kbyte Page +* Translation" shows that the V2 table sign extends the top of the +* address space creating a reserved region in the middle of the +* translation, just like the CPU does. Further Vasant says the docs are +* incomplete and this only applies to non-zero PASIDs. If the AMDv2 +* page table is assigned to the 0 PASID then there is no sign extension +* check. +* +* Since the IOMMU must have a fixed geometry, and the core code does +* not understand sign extended addressing, we have to chop off the high +* bit to get consistent behavior with attachments of the domain to any +* PASID. +*/ +return ((1ULL << (PM_LEVEL_SHIFT (amd_iommu_gpt_level) -1 )) -1 ); }static bool amd_iommu_hd_support (struct amd_iommu *iommu)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 233/627 rcu: Fix delayed execution of hurry callbacks
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tze-nan Wu <[email protected]>
[ Upstream commit 463d46044f04013306a4893242f65788b8a16b2e ]
We observed a regression in our customer’s environment after enabling CONFIG_LAZY_RCU. In the Android Update Engine scenario, where ioctl() is used heavily, we found that callbacks queued via call_rcu_hurry (such as percpu_ref_switch_to_atomic_rcu) can sometimes be delayed by up to 5 seconds before execution. This occurs because the new grace period does not start immediately after the previous one completes.
The root cause is that the wake_nocb_gp_defer() function now checks "rdp->nocb_defer_wakeup" instead of "rdp_gp->nocb_defer_wakeup". On CPUs that are not rcuog, "rdp->nocb_defer_wakeup" may always be RCU_NOCB_WAKE_NOT. This can cause "rdp_gp->nocb_defer_wakeup" to be downgraded and the "rdp_gp->nocb_timer" to be postponed by up to 10 seconds, delaying the execution of hurry RCU callbacks.
The trace log of one scenario we encountered is as follow:
// previous GP ends at this point
rcu_preempt [000] d..1. 137.240210: rcu_grace_period: rcu_preempt 8369 end rcu_preempt [000] ..... 137.240212: rcu_grace_period: rcu_preempt 8372 reqwait // call_rcu_hurry enqueues "percpu_ref_switch_to_atomic_rcu", the callback waited on by UpdateEngine update_engine [002] d..1. 137.301593: __call_rcu_common: wyy: unlikely p_ref = 00000000********. lazy = 0 // FirstQ on cpu 2 rdp_gp->nocb_timer is set to fire after 1 jiffy (4ms) // and the rdp_gp->nocb_defer_wakeup is set to RCU_NOCB_WAKE update_engine [002] d..2. 137.301595: rcu_nocb_wake: rcu_preempt 2 FirstQ on cpu2 with rdp_gp (cpu0). // FirstBQ event on cpu2 during the 1 jiffy, make the timer postpond 10 seconds later. // also, the rdp_gp->nocb_defer_wakeup is overwrite to RCU_NOCB_WAKE_LAZY update_engine [002] d..1. 137.301601: rcu_nocb_wake: rcu_preempt 2 WakeEmptyIsDeferred ... ... ... // before the 10 seconds timeout, cpu0 received another call_rcu_hurry // reset the timer to jiffies+1 and set the waketype = RCU_NOCB_WAKE. kworker/u32:0 [000] d..2. 142.557564: rcu_nocb_wake: rcu_preempt 0 FirstQ kworker/u32:0 [000] d..1. 142.557576: rcu_nocb_wake: rcu_preempt 0 WakeEmptyIsDeferred kworker/u32:0 [000] d..1. 142.558296: rcu_nocb_wake: rcu_preempt 0 WakeNot kworker/u32:0 [000] d..1. 142.558562: rcu_nocb_wake: rcu_preempt 0 WakeNot // idle(do_nocb_deferred_wakeup) wake rcuog due to waketype == RCU_NOCB_WAKE <idle> [000] d..1. 142.558786: rcu_nocb_wake: rcu_preempt 0 DoWake <idle> [000] dN.1. 142.558839: rcu_nocb_wake: rcu_preempt 0 DeferredWake rcuog/0 [000] ..... 142.558871: rcu_nocb_wake: rcu_preempt 0 EndSleep rcuog/0 [000] ..... 142.558877: rcu_nocb_wake: rcu_preempt 0 Check // finally rcuog request a new GP at this point (5 seconds after the FirstQ event) rcuog/0 [000] d..2. 142.558886: rcu_grace_period: rcu_preempt 8372 newreq rcu_preempt [001] d..1. 142.559458: rcu_grace_period: rcu_preempt 8373 start ... rcu_preempt [000] d..1. 142.564258: rcu_grace_period: rcu_preempt 8373 end rcuop/2 [000] D..1. 142.566337: rcu_batch_start: rcu_preempt CBs=219 bl=10
// the hurry CB is invoked at this point
rcuop/2 [000] b.... 142.566352: blk_queue_usage_counter_release: wyy: wakeup. p_ref = 00000000********.
This patch changes the condition to check "rdp_gp->nocb_defer_wakeup" in the lazy path. This prevents an already scheduled "rdp_gp->nocb_timer" from being postponed and avoids overwriting "rdp_gp->nocb_defer_wakeup" when it is not RCU_NOCB_WAKE_NOT.
--- kernel/rcu/tree_nocb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_nocb.h +1 -1
@@ -276,7 +276,7 @@ static void wake_nocb_gp_defer(struct rcu_data *rdp, int waketype,* callback storms, no need to wake up too early. */ if (waketype ==RCU_NOCB_WAKE_LAZY && - rdp->nocb_defer_wakeup ==RCU_NOCB_WAKE_NOT ) { + rdp_gp->nocb_defer_wakeup ==RCU_NOCB_WAKE_NOT ) {mod_timer (&rdp_gp->nocb_timer, jiffies +rcu_get_jiffies_lazy_flush ());WRITE_ONCE (rdp_gp->nocb_defer_wakeup, waketype); }else if (waketype ==RCU_NOCB_WAKE_BYPASS ) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 234/627 wifi: mac80211: reject TDLS operations when station is not associated
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Moon Hee Lee <[email protected]>
[ Upstream commit 16ecdab5446f15a61ec88eb0d23d25d009821db0 ]
syzbot triggered a WARN in ieee80211_tdls_oper() by sending NL80211_TDLS_ENABLE_LINK immediately after NL80211_CMD_CONNECT, before association completed and without prior TDLS setup.
This left internal state like sdata->u.mgd.tdls_peer uninitialized, leading to a WARN_ON() in code paths that assumed it was valid.
Reject the operation early if not in station mode or not associated.
--- net/mac80211/tdls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tdls.c +1 -1
@@ -1422,7 +1422,7 @@ int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,if (!(wiphy->flags &WIPHY_FLAG_SUPPORTS_TDLS ))return -EOPNOTSUPP ; -if (sdata->vif.type !=NL80211_IFTYPE_STATION ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION || !sdata->vif.cfg.assoc)return -EINVAL ;switch (oper) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 235/627 wifi: plfxlc: Fix error handling in usb driver probe
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Murad Masimov <[email protected]>
[ Upstream commit 3fe79a25c3cd54d25d30bc235c0c57f8a123d9d5 ]
If probe fails before ieee80211_register_hw() is successfully done, ieee80211_unregister_hw() will be called anyway. This may lead to various bugs as the implementation of ieee80211_unregister_hw() assumes that ieee80211_register_hw() has been called.
Divide error handling section into relevant subsections, so that ieee80211_unregister_hw() is called only when it is appropriate. Correct the order of the calls: ieee80211_unregister_hw() should go before plfxlc_mac_release(). Also move ieee80211_free_hw() to plfxlc_mac_release() as it supposed to be the opposite to plfxlc_mac_alloc_hw() that calls ieee80211_alloc_hw().
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
--- drivers/net/wireless/purelifi/plfxlc/mac.c | 11 ++++---- drivers/net/wireless/purelifi/plfxlc/mac.h | 2 +- drivers/net/wireless/purelifi/plfxlc/usb.c | 29 +++++++++++----------- 3 files changed, 21 insertions(+), 21 deletions(-)
drivers/net/wireless/purelifi/plfxlc/mac.c +6 -5
@@ -99,11 +99,6 @@ int plfxlc_mac_init_hw(struct ieee80211_hw *hw)return r; } -void plfxlc_mac_release (struct plfxlc_mac *mac) -{ -plfxlc_chip_release (&mac->chip); -} -int plfxlc_op_start (struct ieee80211_hw *hw) {plfxlc_hw_mac (hw)->chip.usb.initialized =1 ;
@@ -755,3 +750,9 @@ struct ieee80211_hw *plfxlc_mac_alloc_hw(struct usb_interface *intf)SET_IEEE80211_DEV (hw, &intf->dev);return hw; } + +void plfxlc_mac_release_hw (struct ieee80211_hw *hw) +{ +plfxlc_chip_release (&plfxlc_hw_mac (hw)->chip); +ieee80211_free_hw (hw); +}
drivers/net/wireless/purelifi/plfxlc/mac.h +1 -1
@@ -168,7 +168,7 @@ static inline u8 *plfxlc_mac_get_perm_addr(struct plfxlc_mac *mac) }struct ieee80211_hw *plfxlc_mac_alloc_hw (struct usb_interface *intf); -void plfxlc_mac_release (struct plfxlc_mac *mac); +void plfxlc_mac_release_hw (struct ieee80211_hw *hw);int plfxlc_mac_preinit_hw (struct ieee80211_hw *hw,const u8 *hw_address);int plfxlc_mac_init_hw (struct ieee80211_hw *hw);
drivers/net/wireless/purelifi/plfxlc/usb.c +14 -15
@@ -604,7 +604,7 @@ static int probe(struct usb_interface *intf, r =plfxlc_upload_mac_and_serial (intf, hw_address, serial_number);if (r) {dev_err (&intf->dev,"MAC and Serial upload failed (%d)\n" , r); - goto error; + goto error_free_hw; } chip->unit_type =STA ;
@@ -613,13 +613,13 @@ static int probe(struct usb_interface *intf, r =plfxlc_mac_preinit_hw (hw, hw_address);if (r) {dev_err (&intf->dev,"Init mac failed (%d)\n" , r); - goto error; + goto error_free_hw; } r =ieee80211_register_hw (hw);if (r) {dev_err (&intf->dev,"Register device failed (%d)\n" , r); - goto error; + goto error_free_hw; } if ((le16_to_cpu(interface_to_usbdev(intf)->descriptor.idVendor) ==
@@ -632,7 +632,7 @@ static int probe(struct usb_interface *intf, }if (r !=0 ) {dev_err (&intf->dev,"FPGA download failed (%d)\n" , r); - goto error; + goto error_unreg_hw; } tx->mac_fifo_full =0 ;
@@ -642,21 +642,21 @@ static int probe(struct usb_interface *intf, r =plfxlc_usb_init_hw (usb);if (r <0 ) {dev_err (&intf->dev,"usb_init_hw failed (%d)\n" , r); - goto error; + goto error_unreg_hw; }msleep (PLF_MSLEEP_TIME ); r =plfxlc_chip_switch_radio (chip,PLFXLC_RADIO_ON );if (r <0 ) {dev_dbg (&intf->dev,"chip_switch_radio_on failed (%d)\n" , r); - goto error; + goto error_unreg_hw; }msleep (PLF_MSLEEP_TIME ); r =plfxlc_chip_set_rate (chip,8 );if (r <0 ) {dev_dbg (&intf->dev,"chip_set_rate failed (%d)\n" , r); - goto error; + goto error_unreg_hw; }msleep (PLF_MSLEEP_TIME );
@@ -664,7 +664,7 @@ static int probe(struct usb_interface *intf, hw_address, ETH_ALEN, USB_REQ_MAC_WR);if (r <0 ) {dev_dbg (&intf->dev,"MAC_WR failure (%d)\n" , r); - goto error; + goto error_unreg_hw; }plfxlc_chip_enable_rxtx (chip);
@@ -691,12 +691,12 @@ static int probe(struct usb_interface *intf,plfxlc_mac_init_hw (hw); usb->initialized = true;return 0 ; + +error_unreg_hw: +ieee80211_unregister_hw (hw); +error_free_hw: +plfxlc_mac_release_hw (hw); error: -if (hw) { -plfxlc_mac_release (plfxlc_hw_mac (hw)); -ieee80211_unregister_hw (hw); -ieee80211_free_hw (hw); - }dev_err (&intf->dev,"pureLifi:Device error" );return r; }
@@ -730,8 +730,7 @@ static void disconnect(struct usb_interface *intf)*/ usb_reset_device (interface_to_usbdev (intf)); -plfxlc_mac_release (mac); -ieee80211_free_hw (hw); +plfxlc_mac_release_hw (hw); }static void plfxlc_usb_resume (struct plfxlc_usb *usb)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 236/627 wifi: cfg80211: Add missing lock in cfg80211_check_and_end_cac()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit 2c5dee15239f3f3e31aa5c8808f18996c039e2c1 ]
Callers of wdev_chandef() must hold the wiphy mutex.
But the worker cfg80211_propagate_cac_done_wk() never takes the lock. Which triggers the warning below with the mesh_peer_connected_dfs test from hostapd and not (yet) released mac80211 code changes:
WARNING: CPU: 0 PID: 495 at net/wireless/chan.c:1552 wdev_chandef+0x60/0x165 Modules linked in: CPU: 0 UID: 0 PID: 495 Comm: kworker/u4:2 Not tainted 6.14.0-rc5-wt-g03960e6f9d47 #33 13c287eeabfe1efea01c0bcc863723ab082e17cf Workqueue: cfg80211 cfg80211_propagate_cac_done_wk Stack: 00000000 00000001 ffffff00 6093267c 00000000 6002ec30 6d577c50 60037608 00000000 67e8d108 6063717b 00000000 Call Trace: [<6002ec30>] ? _printk+0x0/0x98 [<6003c2b3>] show_stack+0x10e/0x11a [<6002ec30>] ? _printk+0x0/0x98 [<60037608>] dump_stack_lvl+0x71/0xb8 [<6063717b>] ? wdev_chandef+0x60/0x165 [<6003766d>] dump_stack+0x1e/0x20 [<6005d1b7>] __warn+0x101/0x20f [<6005d3a8>] warn_slowpath_fmt+0xe3/0x15d [<600b0c5c>] ? mark_lock.part.0+0x0/0x4ec [<60751191>] ? __this_cpu_preempt_check+0x0/0x16 [<600b11a2>] ? mark_held_locks+0x5a/0x6e [<6005d2c5>] ? warn_slowpath_fmt+0x0/0x15d [<60052e53>] ? unblock_signals+0x3a/0xe7 [<60052f2d>] ? um_set_signals+0x2d/0x43 [<60751191>] ? __this_cpu_preempt_check+0x0/0x16 [<607508b2>] ? lock_is_held_type+0x207/0x21f [<6063717b>] wdev_chandef+0x60/0x165 [<605f89b4>] regulatory_propagate_dfs_state+0x247/0x43f [<60052f00>] ? um_set_signals+0x0/0x43 [<605e6bfd>] cfg80211_propagate_cac_done_wk+0x3a/0x4a [<6007e460>] process_scheduled_works+0x3bc/0x60e [<6007d0ec>] ? move_linked_works+0x4d/0x81 [<6007d120>] ? assign_work+0x0/0xaa [<6007f81f>] worker_thread+0x220/0x2dc [<600786ef>] ? set_pf_worker+0x0/0x57 [<60087c96>] ? to_kthread+0x0/0x43 [<6008ab3c>] kthread+0x2d3/0x2e2 [<6007f5ff>] ? worker_thread+0x0/0x2dc [<6006c05b>] ? calculate_sigpending+0x0/0x56 [<6003b37d>] new_thread_handler+0x4a/0x64 irq event stamp: 614611 hardirqs last enabled at (614621): [<00000000600bc96b>] __up_console_sem+0x82/0xaf hardirqs last disabled at (614630): [<00000000600bc92c>] __up_console_sem+0x43/0xaf softirqs last enabled at (614268): [<00000000606c55c6>] __ieee80211_wake_queue+0x933/0x985 softirqs last disabled at (614266): [<00000000606c52d6>] __ieee80211_wake_queue+0x643/0x985
--- net/wireless/reg.c | 2 ++ 1 file changed, 2 insertions(+)
net/wireless/reg.c +2 -0
@@ -4229,6 +4229,8 @@ static void cfg80211_check_and_end_cac(struct cfg80211_registered_device *rdev)struct wireless_dev *wdev;unsigned int link_id; +guard (wiphy)(&rdev->wiphy); +/* If we finished CAC or received radar, we should end any * CAC running on the same channels. * the check !cfg80211_chandef_dfs_usable contain 2 options:
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 237/627 wifi: mac80211: Do not schedule stopped TXQs
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit 11e3e22fa533f5d7cf04e32343b05a27eda3c7a5 ]
Ignore TXQs with the flag IEEE80211_TXQ_STOP when scheduling a queue.
The flag is only set after all fragments have been dequeued and won't allow dequeueing other frames as long as the flag is set.
For drivers using ieee80211_txq_schedule_start() this prevents an loop trying to push the queued frames while IEEE80211_TXQ_STOP is set:
After setting IEEE80211_TXQ_STOP the driver will call ieee80211_return_txq(). Which calls __ieee80211_schedule_txq(), detects that there sill are frames in the queue and immediately restarts the stopped TXQ. Which can't dequeue any frame and thus starts over the loop.
--- net/mac80211/tx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/tx.c +3 -1
@@ -4098,7 +4098,9 @@ void __ieee80211_schedule_txq(struct ieee80211_hw *hw,spin_lock_bh (&local->active_txq_lock[txq->ac]); - has_queue = force ||txq_has_queue (txq); + has_queue = force || + (!test_bit (IEEE80211_TXQ_STOP , &txqi->flags) && +txq_has_queue (txq));if (list_empty (&txqi->schedule_order) && (has_queue ||ieee80211_txq_keep_active (txqi))) {/* If airtime accounting is active, always enqueue STAs at the
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 238/627 wifi: mac80211: Dont call fq_flow_idx() for management frames
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Wetzel <[email protected]>
[ Upstream commit cb3bb3d88dfcd177a1050c0a009a3ee147b2e5b9 ]
skb_get_hash() can only be used when the skb is linked to a netdev device.
--- net/mac80211/tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/tx.c +2 -1
@@ -1428,7 +1428,7 @@ static void ieee80211_txq_enqueue(struct ieee80211_local *local, {struct fq *fq = &local->fq;struct fq_tin *tin = &txqi->tin; -u32 flow_idx =fq_flow_idx (fq, skb); +u32 flow_idx;ieee80211_set_skb_enqueue_time (skb);
@@ -1444,6 +1444,7 @@ static void ieee80211_txq_enqueue(struct ieee80211_local *local,IEEE80211_TX_INTCFL_NEED_TXPROCESSING ;__skb_queue_tail (&txqi->frags, skb); }else { + flow_idx =fq_flow_idx (fq, skb);fq_tin_enqueue (fq, tin, flow_idx, skb, fq_skb_free_func); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 239/627 wifi: mac80211: Check 802.11 encaps offloading in ieee80211_tx_h_select_key()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 4037c468d1b3c508d69e6df0ef47fdee3d440e39 ]
With 802.11 encapsulation offloading, ieee80211_tx_h_select_key() is called on 802.3 frames. In that case do not try to use skb data as valid 802.11 headers.
--- net/mac80211/tx.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/mac80211/tx.c +6 -0
@@ -612,6 +612,12 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)else tx->key =NULL ; +if (info->flags &IEEE80211_TX_CTL_HW_80211_ENCAP ) { +if (tx->key && tx->key->flags &KEY_FLAG_UPLOADED_TO_HARDWARE ) + info->control.hw_key = &tx->key->conf; +return TX_CONTINUE ; + } +if (tx->key) {bool skip_hw = false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 240/627 Reapply "wifi: mac80211: Update skbs control block key in ieee80211_tx_dequeue()"
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Remi Pommarel <[email protected]>
[ Upstream commit 754fe848b3b297fc85ec24cd959bad22b6df8cb8 ]
This reverts commit 0937cb5f345c ("Revert "wifi: mac80211: Update skb's control block key in ieee80211_tx_dequeue()"").
This commit broke TX with 802.11 encapsulation HW offloading, now that this is fixed, reapply it.
--- net/mac80211/tx.c | 1 + 1 file changed, 1 insertion(+)
net/mac80211/tx.c +1 -0
@@ -3883,6 +3883,7 @@ struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,* The key can be removed while the packet was queued, so need to call * this here to get the current key. */ + info->control.hw_key =NULL ; r =ieee80211_tx_h_select_key (&tx);if (r !=TX_CONTINUE ) {ieee80211_free_txskb (&local->hw, skb);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 241/627 wifi: ath12k: fix endianness handling while accessing wmi service bit
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tamizh Chelvam Raja <[email protected]>
[ Upstream commit 8f1a078842d4af4877fb686f3907788024d0d1b7 ]
Currently there is no endian conversion in ath12k_wmi_tlv_services_parser() so the service bit parsing will be incorrect on a big endian platform and to fix this by using appropriate endian conversion.
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00217-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/wmi.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/wmi.c +7 -5
@@ -7491,7 +7491,7 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab, void *data) {const struct wmi_service_available_event *ev; -u32 *wmi_ext2_service_bitmap; +__le32 *wmi_ext2_service_bitmap;int i, j;u16 expected_len;
@@ -7523,12 +7523,12 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab, ev->wmi_service_segment_bitmap[3]);break ;case WMI_TAG_ARRAY_UINT32 : - wmi_ext2_service_bitmap = (u32 *)ptr; + wmi_ext2_service_bitmap = (__le32 *)ptr;for (i =0 , j =WMI_MAX_EXT_SERVICE ; i <WMI_SERVICE_SEGMENT_BM_SIZE32 && j <WMI_MAX_EXT2_SERVICE ; i++) {do { -if (wmi_ext2_service_bitmap[i] & +if (__le32_to_cpu (wmi_ext2_service_bitmap[i]) &BIT (j %WMI_AVAIL_SERVICE_BITS_IN_SIZE32 ))set_bit (j, ab->wmi_ab.svc_map); }while (++j %WMI_AVAIL_SERVICE_BITS_IN_SIZE32 );
@@ -7536,8 +7536,10 @@ static int ath12k_wmi_tlv_services_parser(struct ath12k_base *ab,ath12k_dbg (ab,ATH12K_DBG_WMI ,"wmi_ext2_service_bitmap 0x%04x 0x%04x 0x%04x 0x%04x" , - wmi_ext2_service_bitmap[0 ], wmi_ext2_service_bitmap[1 ], - wmi_ext2_service_bitmap[2 ], wmi_ext2_service_bitmap[3 ]); +__le32_to_cpu (wmi_ext2_service_bitmap[0 ]), +__le32_to_cpu (wmi_ext2_service_bitmap[1 ]), +__le32_to_cpu (wmi_ext2_service_bitmap[2 ]), +__le32_to_cpu (wmi_ext2_service_bitmap[3 ]));break ; }return 0 ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 242/627 wifi: brcmfmac: fix P2P discovery failure in P2P peer due to missing P2P IE
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gokul Sivakumar <[email protected]>
[ Upstream commit 579bf8037b70b644a674c126a32bbb2212cf5c21 ]
After commit bd99a3013bdc ("brcmfmac: move configuration of probe request IEs"), the probe request MGMT IE addition operation brcmf_vif_set_mgmt_ie() got moved from the brcmf_p2p_scan_prep() to the brcmf_cfg80211_scan().
Because of this, as part of the scan request handler for the P2P Discovery, vif struct used for adding the Probe Request P2P IE in firmware got changed from the P2PAPI_BSSCFG_DEVICE vif to P2PAPI_BSSCFG_PRIMARY vif incorrectly. So the firmware stopped adding P2P IE to the outgoing P2P Discovery probe requests frames and the other P2P peers were unable to discover this device causing a regression on the P2P feature.
To fix this, while setting the P2P IE in firmware, properly use the vif of the P2P discovery wdev on which the driver received the P2P scan request. This is done by not changing the vif pointer, until brcmf_vif_set_mgmt_ie() is completed.
--- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +4 -4
@@ -1544,10 +1544,6 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)return -EAGAIN ; } -/* If scan req comes for p2p0, send it over primary I/F */ -if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE ].vif) - vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY ].vif; -brcmf_dbg (SCAN ,"START ESCAN\n" ); cfg->scan_request = request;
@@ -1563,6 +1559,10 @@ brcmf_cfg80211_scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)if (err) goto scan_out; +/* If scan req comes for p2p0, send it over primary I/F */ +if (vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_DEVICE ].vif) + vif = cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY ].vif; + err =brcmf_do_escan (vif->ifp, request);if (err) goto scan_out;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 243/627 PM: cpufreq: powernv/tracing: Move powernv_throttle trace event
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 647fe16b46999258ce1aec41f4bdeabb4f0cc8e7 ]
As the trace event powernv_throttle is only used by the powernv code, move it to a separate include file and have that code directly enable it.
Trace events can take up around 5K of memory when they are defined regardless if they are used or not. It wastes memory to have them defined in configurations where the tracepoint is not used.
--- drivers/cpufreq/Makefile | 1 + drivers/cpufreq/powernv-cpufreq.c | 4 ++- drivers/cpufreq/powernv-trace.h | 44 +++++++++++++++++++++++++++++++ include/trace/events/power.h | 22 ---------------- kernel/trace/power-traces.c | 1 - 5 files changed, 48 insertions(+), 24 deletions(-) create mode 100644 drivers/cpufreq/powernv-trace.h
drivers/cpufreq/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_CPUFREQ_VIRT) += virtual-cpufreq.o # Traces CFLAGS_amd-pstate-trace.o := -I$(src) +CFLAGS_powernv-cpufreq.o := -I$(src) amd_pstate-y := amd-pstate.o amd-pstate-trace.o ##################################################################################
drivers/cpufreq/powernv-cpufreq.c +3 -1
@@ -21,7 +21,6 @@#include <linux/string_choices.h> #include <linux/cpu.h> #include <linux/hashtable.h> -#include <trace/events/power.h> #include <asm/cputhreads.h> #include <asm/firmware.h>
@@ -30,6 +29,9 @@#include <asm/opal.h> #include <linux/timer.h> +#define CREATE_TRACE_POINTS +#include "powernv-trace.h" +#define POWERNV_MAX_PSTATES_ORDER 8#define POWERNV_MAX_PSTATES (1UL << (POWERNV_MAX_PSTATES_ORDER))#define PMSR_PSAFE_ENABLE (1UL << 30)
drivers/cpufreq/powernv-trace.h new file +44 -0
44 lines not on this page · raw message
include/trace/events/power.h +0 -22
@@ -99,28 +99,6 @@ DEFINE_EVENT(psci_domain_idle, psci_domain_idle_exit,TP_ARGS (cpu_id, state, s2idle) ); -TRACE_EVENT (powernv_throttle, - - TP_PROTO(int chip_id, const char *reason, int pmax), - -TP_ARGS (chip_id, reason, pmax), - -TP_STRUCT__entry ( - __field(int, chip_id) - __string(reason, reason) -__field (int, pmax) - ), - -TP_fast_assign ( - __entry->chip_id = chip_id; - __assign_str(reason); - __entry->pmax = pmax; - ), - -TP_printk ("Chip %d Pmax %d %s" , __entry->chip_id, - __entry->pmax,__get_str (reason)) -); - TRACE_EVENT(pstate_sample, TP_PROTO(u32 core_busy,
kernel/trace/power-traces.c +0 -1
@@ -17,5 +17,4 @@EXPORT_TRACEPOINT_SYMBOL_GPL (suspend_resume);EXPORT_TRACEPOINT_SYMBOL_GPL (cpu_idle);EXPORT_TRACEPOINT_SYMBOL_GPL (cpu_frequency); -EXPORT_TRACEPOINT_SYMBOL_GPL (powernv_throttle);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 244/627 wifi: mac80211: Write cnt before copying in ieee80211_copy_rnr_beacon()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit a37192c432adaec9e8ef29e4ddb319ea2f443aa6 ]
While I caught the need for setting cnt early in nl80211_parse_rnr_elems() in the original annotation of struct cfg80211_rnr_elems with __counted_by, I missed a similar pattern in ieee80211_copy_rnr_beacon(). Fix this by moving the cnt assignment to before the loop.
--- net/mac80211/cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/cfg.c +1 -1
@@ -1122,13 +1122,13 @@ ieee80211_copy_rnr_beacon(u8 *pos, struct cfg80211_rnr_elems *dst, {int i, offset =0 ; + dst->cnt = src->cnt;for (i =0 ; i < src->cnt; i++) {memcpy (pos + offset, src->elem[i].data, src->elem[i].len); dst->elem[i].len = src->elem[i].len; dst->elem[i].data = pos + offset; offset += dst->elem[i].len; } - dst->cnt = src->cnt;return offset; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 245/627 wifi: nl80211: Set num_sub_specs before looping through sub_specs
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit 2ed9a9fc9976262109d04f1a3c75c46de8ce4f22 ]
The processing of the struct cfg80211_sar_specs::sub_specs flexible array requires its counter, num_sub_specs, to be assigned before the loop in nl80211_set_sar_specs(). Leave the final assignment after the loop in place in case fewer ended up in the array.
--- net/wireless/nl80211.c | 1 + 1 file changed, 1 insertion(+)
net/wireless/nl80211.c +1 -0
@@ -16932,6 +16932,7 @@ static int nl80211_set_sar_specs(struct sk_buff *skb, struct genl_info *info)if (!sar_spec)return -ENOMEM ; + sar_spec->num_sub_specs = specs; sar_spec->type = type; specs =0 ;nla_for_each_nested (spec_list, tb[NL80211_SAR_ATTR_SPECS ], rem) {
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 246/627 ring-buffer: Remove ring_buffer_read_prepare_sync()
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 119a5d573622ae90ba730d18acfae9bb75d77b9a ]
When the ring buffer was first introduced, reading the non-consuming "trace" file required disabling the writing of the ring buffer. To make sure the writing was fully disabled before iterating the buffer with a non-consuming read, it would set the disable flag of the buffer and then call an RCU synchronization to make sure all the buffers were synchronized.
The function ring_buffer_read_start() originally would initialize the iterator and call an RCU synchronization, but this was for each individual per CPU buffer where this would get called many times on a machine with many CPUs before the trace file could be read. The commit 72c9ddfd4c5bf ("ring-buffer: Make non-consuming read less expensive with lots of cpus.") separated ring_buffer_read_start into ring_buffer_read_prepare(), ring_buffer_read_sync() and then ring_buffer_read_start() to allow each of the per CPU buffers to be prepared, call the read_buffer_read_sync() once, and then the ring_buffer_read_start() for each of the CPUs which made things much faster.
The commit 1039221cc278 ("ring-buffer: Do not disable recording when there is an iterator") removed the requirement of disabling the recording of the ring buffer in order to iterate it, but it did not remove the synchronization that was happening that was required to wait for all the buffers to have no more writers. It's now OK for the buffers to have writers and no synchronization is needed.
Remove the synchronization and put back the interface for the ring buffer iterator back before commit 72c9ddfd4c5bf was applied.
--- include/linux/ring_buffer.h | 4 +-- kernel/trace/ring_buffer.c | 63 ++++++------------------------------- kernel/trace/trace.c | 14 +++------ kernel/trace/trace_kdb.c | 8 ++--- 4 files changed, 18 insertions(+), 71 deletions(-)
include/linux/ring_buffer.h +1 -3
@@ -152,9 +152,7 @@ ring_buffer_consume(struct trace_buffer *buffer, int cpu, u64 *ts, unsigned long *lost_events);struct ring_buffer_iter * -ring_buffer_read_prepare (struct trace_buffer *buffer,int cpu,gfp_t flags); -void ring_buffer_read_prepare_sync (void ); -void ring_buffer_read_start (struct ring_buffer_iter *iter); +ring_buffer_read_start (struct trace_buffer *buffer,int cpu,gfp_t flags);void ring_buffer_read_finish (struct ring_buffer_iter *iter); struct ring_buffer_event *
kernel/trace/ring_buffer.c +10 -53
85 lines not on this page · raw message
kernel/trace/trace.c +4 -10
@@ -4735,21 +4735,15 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot)if (iter->cpu_file ==RING_BUFFER_ALL_CPUS ) {for_each_tracing_cpu (cpu) { iter->buffer_iter[cpu] = -ring_buffer_read_prepare (iter->array_buffer->buffer, - cpu,GFP_KERNEL ); - } -ring_buffer_read_prepare_sync (); -for_each_tracing_cpu (cpu) { -ring_buffer_read_start (iter->buffer_iter[cpu]); +ring_buffer_read_start (iter->array_buffer->buffer, + cpu,GFP_KERNEL );tracing_iter_reset (iter, cpu); } }else { cpu = iter->cpu_file; iter->buffer_iter[cpu] = -ring_buffer_read_prepare (iter->array_buffer->buffer, - cpu,GFP_KERNEL ); -ring_buffer_read_prepare_sync (); -ring_buffer_read_start (iter->buffer_iter[cpu]); +ring_buffer_read_start (iter->array_buffer->buffer, + cpu,GFP_KERNEL );tracing_iter_reset (iter, cpu); }
kernel/trace/trace_kdb.c +3 -5
@@ -43,17 +43,15 @@ static void ftrace_dump_buf(int skip_entries, long cpu_file)if (cpu_file ==RING_BUFFER_ALL_CPUS ) {for_each_tracing_cpu (cpu) { iter.buffer_iter[cpu] = -ring_buffer_read_prepare (iter.array_buffer->buffer, - cpu,GFP_ATOMIC ); -ring_buffer_read_start (iter.buffer_iter[cpu]); +ring_buffer_read_start (iter.array_buffer->buffer, + cpu,GFP_ATOMIC );tracing_iter_reset (&iter, cpu); } }else { iter.cpu_file = cpu_file; iter.buffer_iter[cpu_file] = -ring_buffer_read_prepare (iter.array_buffer->buffer, +ring_buffer_read_start (iter.array_buffer->buffer, cpu_file,GFP_ATOMIC ); -ring_buffer_read_start (iter.buffer_iter[cpu_file]);tracing_iter_reset (&iter, cpu_file); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 247/627 kcsan: test: Initialize dummy variable
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
[ Upstream commit 9872916ad1a1a5e7d089e05166c85dbd65e5b0e8 ]
Newer compiler versions rightfully point out:
kernel/kcsan/kcsan_test.c:591:41: error: variable 'dummy' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
591 | KCSAN_EXPECT_READ_BARRIER(atomic_read(&dummy), false);
| ^~~~~
1 error generated.
Although this particular test does not care about the value stored in the dummy atomic variable, let's silence the warning.
--- kernel/kcsan/kcsan_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/kcsan/kcsan_test.c +1 -1
@@ -533,7 +533,7 @@ static void test_barrier_nothreads(struct kunit *test)struct kcsan_scoped_access *reorder_access =NULL ;#endif arch_spinlock_t arch_spinlock = __ARCH_SPIN_LOCK_UNLOCKED; -atomic_t dummy; +atomic_t dummy =ATOMIC_INIT (0 );KCSAN_TEST_REQUIRES (test, reorder_access !=NULL );KCSAN_TEST_REQUIRES (test,IS_ENABLED (CONFIG_SMP ));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 248/627 memcg_slabinfo: Fix use of PG_slab
In reply to Greg Kroah-Hartman6.16-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit 7f770e94d7936e8e35d4b4d5fa4618301b03ea33 ]
Check PGTY_slab instead of PG_slab.
--- tools/cgroup/memcg_slabinfo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/cgroup/memcg_slabinfo.py +2 -2
@@ -146,11 +146,11 @@ def detect_kernel_config(): def for_each_slab(prog): - PGSlab = ~prog.constant('PG_slab') + slabtype = prog.constant('PGTY_slab') for page in for_each_page(prog): try: - if page.page_type.value_() == PGSlab: + if (page.page_type.value_() >> 24) == slabtype: yield cast('struct slab *', page) except FaultError: pass
Signature · 1 line
2.39.5