6.1.93-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 294/473 PCI: tegra194: Fix probe path for Endpoint mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vidya Sagar <[email protected]>
[ Upstream commit 19326006a21da26532d982254677c892dae8f29b ]
Tegra194 PCIe probe path is taking failure path in success case for Endpoint mode. Return success from the switch case instead of going into the failure path.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/pci/controller/dwc/pcie-tegra194.c +3 -0
@@ -2250,11 +2250,14 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev) ret =tegra_pcie_config_ep (pcie, pdev);if (ret <0 ) goto fail; +else +return 0 ;break ;default :dev_err (dev,"Invalid PCIe device type %d\n" , pcie->of_data->mode); + ret = -EINVAL ; } fail:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 295/473 serial: sc16is7xx: add proper sched.h include for sched_set_fifo()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugo Villeneuve <[email protected]>
[ Upstream commit 2a8e4ab0c93fad30769479f86849e22d63cd0e12 ]
Replace incorrect include with the proper one for sched_set_fifo() declaration.
--- drivers/tty/serial/sc16is7xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sc16is7xx.c +1 -1
@@ -18,6 +18,7 @@#include <linux/module.h> #include <linux/property.h> #include <linux/regmap.h> +#include <linux/sched.h> #include <linux/serial_core.h> #include <linux/serial.h> #include <linux/tty.h>
@@ -25,7 +26,6 @@#include <linux/spi/spi.h> #include <linux/uaccess.h> #include <linux/units.h> -#include <uapi/linux/sched/types.h> #define SC16IS7XX_NAME "sc16is7xx"#define SC16IS7XX_MAX_DEVS 8
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 296/473 interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 230d05b1179f6ce6f8dc8a2b99eba92799ac22d7 ]
The value was wrong, resulting in misprogramming of the hardware. Fix it.
--- drivers/interconnect/qcom/qcm2290.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/interconnect/qcom/qcm2290.c +1 -1
@@ -164,7 +164,7 @@ static struct qcom_icc_node mas_snoc_bimc = { .name = "mas_snoc_bimc", .buswidth = 16, .qos.ap_owned = true, - .qos.qos_port = 2, + .qos.qos_port = 6, .qos.qos_mode = NOC_QOS_MODE_BYPASS, .mas_rpm_id = 164, .slv_rpm_id = -1,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 297/473 arm64: dts: meson: fix S4 power-controller node
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xianwei Zhao <[email protected]>
[ Upstream commit 72907de9051dc2aa7b55c2a020e2872184ac17cd ]
The power-controller module works well by adding its parent node secure-monitor.
--- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/amlogic/meson-s4.dtsi +9 -4
@@ -61,10 +61,15 @@ xtal: xtal-clk { #clock-cells = <0>; }; - pwrc: power-controller { - compatible = "amlogic,meson-s4-pwrc"; - #power-domain-cells = <1>; - status = "okay"; + firmware { + sm: secure-monitor { + compatible = "amlogic,meson-gxbb-sm"; + + pwrc: power-controller { + compatible = "amlogic,meson-s4-pwrc"; + #power-domain-cells = <1>; + }; + }; }; soc {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 298/473 perf test: Add -w/--workload option
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit f215054d749b17c56e014fdca2fcc592dac4529c ]
The -w/--workload option is to run a simple workload used by testing. This adds a basic framework to run the workloads and 'noploop' workload as an example.
$ perf test -w noploop
The noploop does a loop doing nothing (NOP) for a second by default. It can have an optional argument to specify the time in seconds.
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
--- tools/perf/tests/Build | 2 ++ tools/perf/tests/builtin-test.c | 24 +++++++++++++++++++++ tools/perf/tests/tests.h | 22 +++++++++++++++++++ tools/perf/tests/workloads/Build | 3 +++ tools/perf/tests/workloads/noploop.c | 32 ++++++++++++++++++++++++++++ 5 files changed, 83 insertions(+) create mode 100644 tools/perf/tests/workloads/Build create mode 100644 tools/perf/tests/workloads/noploop.c
tools/perf/tests/Build +2 -0
@@ -103,3 +103,5 @@ endif CFLAGS_attr.o += -DBINDIR="BUILD_STR($(bindir_SQ))" -DPYTHON="BUILD_STR($(PYTHON_WORD))" CFLAGS_python-use.o += -DPYTHONPATH="BUILD_STR($(OUTPUT)python)" -DPYTHON="BUILD_STR($(PYTHON_WORD))" CFLAGS_dwarf-unwind.o += -fno-optimize-sibling-calls + +perf-y += workloads/
tools/perf/tests/builtin-test.c +24 -0
@@ -118,6 +118,10 @@ static struct test_suite **tests[] = { arch_tests, }; +static struct test_workload *workloads[] = { + &workload__noploop, +}; +static int num_subtests (const struct test_suite *t) {int num;
@@ -475,6 +479,21 @@ static int perf_test__list(int argc, const char **argv)return 0 ; } +static int run_workload (const char *work,int argc,const char **argv) +{ +unsigned int i =0 ; +struct test_workload *twl; + +for (i =0 ; i <ARRAY_SIZE (workloads); i++) { + twl = workloads[i]; +if (!strcmp (twl->name, work)) +return twl->func (argc, argv); + } + +pr_info ("No workload found: %s\n" , work); +return -1 ; +} +int cmd_test (int argc,const char **argv) {const char *test_usage[] = {
@@ -482,12 +501,14 @@ int cmd_test(int argc, const char **argv) NULL, };const char *skip =NULL ; +const char *workload =NULL ;const struct option test_options[] = {OPT_STRING ('s' ,"skip" , &skip,"tests" ,"tests to skip" ),OPT_INCR ('v' ,"verbose" , &verbose,"be more verbose (show symbol address, etc)" ),OPT_BOOLEAN ('F' ,"dont-fork" , &dont_fork,"Do not fork for testcase" ), +OPT_STRING ('w' ,"workload" , &workload,"work" ,"workload to run for testing" ),OPT_END () };const char *const test_subcommands[] = {"list" ,NULL };
@@ -504,6 +525,9 @@ int cmd_test(int argc, const char **argv)if (argc >=1 && !strcmp (argv[0 ],"list" ))return perf_test__list (argc -1 , argv +1 ); +if (workload) +return run_workload (workload, argc, argv); + symbol_conf.priv_size =sizeof (int ); symbol_conf.sort_by_name = true; symbol_conf.try_vmlinux_path = true;
tools/perf/tests/tests.h +22 -0
@@ -180,4 +180,26 @@ int test__arch_unwind_sample(struct perf_sample *sample,DECLARE_SUITE (vectors_page);#endif +/* +* Define test workloads to be used in test suites. +*/ +typedef int (*workload_fnptr )(int argc,const char **argv); + +struct test_workload { +const char *name; +workload_fnptr func; +}; + +#define DECLARE_WORKLOAD (work) \ + extern struct test_workload workload__##work + +#define DEFINE_WORKLOAD (work) \ +struct test_workload workload__##work = { \ + .name = #work, \ + .func = work, \ +} + +/* The list of test workloads */ +DECLARE_WORKLOAD (noploop); +#endif /* TESTS_H */
tools/perf/tests/workloads/Build new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +perf-y += noploop.o
tools/perf/tests/workloads/noploop.c new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include <stdlib.h> +#include <signal.h> +#include <unistd.h> +#include <linux/compiler.h> +#include "../tests.h" + +static volatile sig_atomic_t done; + +static void sighandler (int sig__maybe_unused ) +{ + done =1 ; +} + +static int noploop (int argc,const char **argv) +{ +int sec =1 ; + +if (argc >0 ) + sec =atoi (argv[0 ]); + +signal (SIGINT , sighandler); +signal (SIGALRM , sighandler); +alarm (sec); + +while (!done) +continue ; + +return 0 ; +} + +DEFINE_WORKLOAD (noploop);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 299/473 perf test: Add thloop test workload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 69b352927885b17f03d3ee4ee38f580699af107a ]
The thloop is similar to noploop but runs in two threads. This is needed to verify perf record --per-thread to handle multi-threaded programs properly.
$ perf test -w thloop
It also takes an optional argument to specify runtime in seconds (default: 1).
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
--- tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/tests.h | 1 + tools/perf/tests/workloads/Build | 1 + tools/perf/tests/workloads/thloop.c | 53 +++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 tools/perf/tests/workloads/thloop.c
tools/perf/tests/builtin-test.c +1 -0
@@ -120,6 +120,7 @@ static struct test_suite **tests[] = {static struct test_workload *workloads[] = { &workload__noploop, + &workload__thloop, };static int num_subtests (const struct test_suite *t)
tools/perf/tests/tests.h +1 -0
@@ -201,5 +201,6 @@ struct test_workload workload__##work = { \/* The list of test workloads */ DECLARE_WORKLOAD (noploop); +DECLARE_WORKLOAD (thloop);#endif /* TESTS_H */
tools/perf/tests/workloads/Build +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 perf-y += noploop.o +perf-y += thloop.o
tools/perf/tests/workloads/thloop.c new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 300/473 perf test: Add leafloop test workload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 41522f7442905814c654dbe2ca7b8d3605c7e0cc ]
The leafloop workload is to run an infinite loop in the test_leaf function. This is needed for the ARM fp callgraph test to verify if it gets the correct callchains.
$ perf test -w leafloop
Committer notes:
Add a:
-U_FORTIFY_SOURCE
to the leafloop CFLAGS as the main perf flags set it and it requires building with optimization, and this new test has a -O0.
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
--- tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/tests.h | 1 + tools/perf/tests/workloads/Build | 3 +++ tools/perf/tests/workloads/leafloop.c | 34 +++++++++++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 tools/perf/tests/workloads/leafloop.c
tools/perf/tests/builtin-test.c +1 -0
@@ -121,6 +121,7 @@ static struct test_suite **tests[] = {static struct test_workload *workloads[] = { &workload__noploop, &workload__thloop, + &workload__leafloop, };static int num_subtests (const struct test_suite *t)
tools/perf/tests/tests.h +1 -0
@@ -202,5 +202,6 @@ struct test_workload workload__##work = { \/* The list of test workloads */ DECLARE_WORKLOAD (noploop);DECLARE_WORKLOAD (thloop); +DECLARE_WORKLOAD (leafloop);#endif /* TESTS_H */
tools/perf/tests/workloads/Build +3 -0
@@ -2,3 +2,6 @@ perf-y += noploop.o perf-y += thloop.o +perf-y += leafloop.o + +CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE
tools/perf/tests/workloads/leafloop.c new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include <stdlib.h> +#include <linux/compiler.h> +#include "../tests.h" + +/* We want to check these symbols in perf script */ +noinline void leaf(volatile int b); +noinline void parent(volatile int b); + +static volatile int a; + +noinline void leaf(volatile int b) +{ +for (;;) + a += b; +} + +noinline void parent(volatile int b) +{ +leaf (b); +} + +static int leafloop (int argc,const char **argv) +{ +int c =1 ; + +if (argc >0 ) + c =atoi (argv[0 ]); + +parent (c); +return 0 ; +} + +DEFINE_WORKLOAD (leafloop);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 301/473 perf test: Add sqrtloop test workload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 39281709a6e2301ac4c6ac7015c7793392ca2dfe ]
The sqrtloop creates a child process to run an infinite loop calling sqrt() with rand(). This is needed for ARM SPE fork test.
$ perf test -w sqrtloop
It can take an optional argument to specify how long it will run in seconds (default: 1).
Committer notes:
Explicitely ignored the sqrt() return to fix the build on systems where the compiler complains it isn't being used.
And added a sqrtloop specific CFLAGS to disable optimizations to make this a bit more robust wrt dead code elimination.
Doing that a -U_FORTIFY_SOURCE needs to be added, as -O0 is incompatible with it.
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
--- tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/tests.h | 1 + tools/perf/tests/workloads/Build | 2 ++ tools/perf/tests/workloads/sqrtloop.c | 45 +++++++++++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 tools/perf/tests/workloads/sqrtloop.c
tools/perf/tests/builtin-test.c +1 -0
@@ -122,6 +122,7 @@ static struct test_workload *workloads[] = { &workload__noploop, &workload__thloop, &workload__leafloop, + &workload__sqrtloop, };static int num_subtests (const struct test_suite *t)
tools/perf/tests/tests.h +1 -0
@@ -203,5 +203,6 @@ struct test_workload workload__##work = { \DECLARE_WORKLOAD (noploop);DECLARE_WORKLOAD (thloop);DECLARE_WORKLOAD (leafloop); +DECLARE_WORKLOAD (sqrtloop);#endif /* TESTS_H */
tools/perf/tests/workloads/Build +2 -0
@@ -3,5 +3,7 @@ perf-y += noploop.o perf-y += thloop.o perf-y += leafloop.o +perf-y += sqrtloop.o +CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE
tools/perf/tests/workloads/sqrtloop.c new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 302/473 perf test: Add brstack test workload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit a104f0ea99d846df19aad8a5476eb9bc39fa42ca ]
The brstack is to run different kinds of branches repeatedly. This is necessary for brstack test case to verify if it has correct branch info.
$ perf test -w brstack
I renamed the internal functions to have brstack_ prefix as it's too generic name.
Add a -U_FORTIFY_SOURCE to the brstack CFLAGS, as the main perf flags set it and it requires building with optimization, and this new test has a -O0.
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
--- tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/tests.h | 1 + tools/perf/tests/workloads/Build | 2 ++ tools/perf/tests/workloads/brstack.c | 40 ++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 tools/perf/tests/workloads/brstack.c
tools/perf/tests/builtin-test.c +1 -0
@@ -123,6 +123,7 @@ static struct test_workload *workloads[] = { &workload__thloop, &workload__leafloop, &workload__sqrtloop, + &workload__brstack, };static int num_subtests (const struct test_suite *t)
tools/perf/tests/tests.h +1 -0
@@ -204,5 +204,6 @@ DECLARE_WORKLOAD(noploop);DECLARE_WORKLOAD (thloop);DECLARE_WORKLOAD (leafloop);DECLARE_WORKLOAD (sqrtloop); +DECLARE_WORKLOAD (brstack);#endif /* TESTS_H */
tools/perf/tests/workloads/Build +2 -0
@@ -4,6 +4,8 @@ perf-y += noploop.o perf-y += thloop.o perf-y += leafloop.o perf-y += sqrtloop.o +perf-y += brstack.o CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE +CFLAGS_brstack.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
tools/perf/tests/workloads/brstack.c new file +40 -0
@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#include <stdlib.h> +#include "../tests.h" + +#define BENCH_RUNS 999999 + +static volatile int cnt; + +static void brstack_bar (void ) { +}/* return */ + +static void brstack_foo (void ) { +brstack_bar ();/* call */ +}/* return */ + +static void brstack_bench (void ) { +void (*brstack_foo_ind)(void ) = brstack_foo; + +if ((cnt++) %3 )/* branch (cond) */ +brstack_foo ();/* call */ +brstack_bar ();/* call */ +brstack_foo_ind ();/* call (ind) */ +} + +static int brstack (int argc,const char **argv) +{ +int num_loops =BENCH_RUNS ; + +if (argc >0 ) + num_loops =atoi (argv[0 ]); + +while (1 ) { +if ((cnt++) > num_loops) +break ; +brstack_bench ();/* call */ + }/* branch (uncond) */ +return 0 ; +} + +DEFINE_WORKLOAD (brstack);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 303/473 perf test: Add datasym test workload
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit 3dfc01fe9d12a1e832f49deab37279faa8a9ebc8 ]
The datasym workload is to check if perf mem command gets the data addresses precisely. This is needed for data symbol test.
$ perf test -w datasym
I had to keep the buf1 in the data section, otherwise it could end up in the BSS and was mmaped as a separate //anon region, then it was not symbolized at all. It needs to be fixed separately.
Committer notes:
Add a -U _FORTIFY_SOURCE to the datasym CFLAGS, as the main perf flags set it and it requires building with optimization, and this new test has a -O0.
Stable-dep-of: 256ef072b384 ("perf tests: Make "test data symbol" more robust on Neoverse N1")
--- tools/perf/tests/builtin-test.c | 1 + tools/perf/tests/tests.h | 1 + tools/perf/tests/workloads/Build | 2 ++ tools/perf/tests/workloads/datasym.c | 24 ++++++++++++++++++++++++ 4 files changed, 28 insertions(+) create mode 100644 tools/perf/tests/workloads/datasym.c
tools/perf/tests/builtin-test.c +1 -0
@@ -124,6 +124,7 @@ static struct test_workload *workloads[] = { &workload__leafloop, &workload__sqrtloop, &workload__brstack, + &workload__datasym, };static int num_subtests (const struct test_suite *t)
tools/perf/tests/tests.h +1 -0
@@ -205,5 +205,6 @@ DECLARE_WORKLOAD(thloop);DECLARE_WORKLOAD (leafloop);DECLARE_WORKLOAD (sqrtloop);DECLARE_WORKLOAD (brstack); +DECLARE_WORKLOAD (datasym);#endif /* TESTS_H */
tools/perf/tests/workloads/Build +2 -0
@@ -5,7 +5,9 @@ perf-y += thloop.o perf-y += leafloop.o perf-y += sqrtloop.o perf-y += brstack.o +perf-y += datasym.o CFLAGS_sqrtloop.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE CFLAGS_leafloop.o = -g -O0 -fno-inline -fno-omit-frame-pointer -U_FORTIFY_SOURCE CFLAGS_brstack.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE +CFLAGS_datasym.o = -g -O0 -fno-inline -U_FORTIFY_SOURCE
tools/perf/tests/workloads/datasym.c new file +24 -0
@@ -0,0 +1,24 @@ +#include <linux/compiler.h> +#include "../tests.h" + +typedef struct _buf { +char data1; +char reserved[55 ]; +char data2; +}buf __attribute__((aligned (64 ))); + +static buf buf1 = { +/* to have this in the data section */ + .reserved[0 ] =1 , +}; + +static int datasym (int argc__maybe_unused ,const char **argv__maybe_unused ) +{ +for (;;) { + buf1.data1++; + buf1.data2 += buf1.data1; + } +return 0 ; +} + +DEFINE_WORKLOAD (datasym);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 304/473 perf tests: Make "test data symbol" more robust on Neoverse N1
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Clark <[email protected]>
[ Upstream commit 256ef072b3842273ce703db18b603b051aca95fe ]
To prevent anyone from seeing a test failure appear as a regression and thinking that it was caused by their code change, insert some noise into the loop which makes it immune to sampling bias issues (errata 1694299).
The "test data symbol" test can fail with any unrelated change that shifts the loop into an unfortunate position in the Perf binary which is almost impossible to debug as the root cause of the test failure. Ultimately it's caused by the referenced errata.
--- tools/perf/tests/workloads/datasym.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
tools/perf/tests/workloads/datasym.c +16 -0
@@ -16,6 +16,22 @@ static int datasym(int argc __maybe_unused, const char **argv __maybe_unused) {for (;;) { buf1.data1++; +if (buf1.data1 ==123 ) { +/* +* Add some 'noise' in the loop to work around errata +* 1694299 on Arm N1. +* +* Bias exists in SPE sampling which can cause the load +* and store instructions to be skipped entirely. This +* comes and goes randomly depending on the offset the +* linker places the datasym loop at in the Perf binary. +* With an extra branch in the middle of the loop that +* isn't always taken, the instruction stream is no +* longer a continuous repeating pattern that interacts +* badly with the bias. +*/ + buf1.data1++; + } buf1.data2 += buf1.data1; }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 305/473 dt-bindings: PCI: rcar-pci-host: Add optional regulators
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit b952f96a57e6fb4528c1d6be19e941c3322f9905 ]
Support regulators found on the KingFisher board for miniPCIe (1.5 and 3.3v). For completeness, describe a 12v regulator while we are here.
Stable-dep-of: 78d212851f0e ("dt-bindings: PCI: rcar-pci-host: Add missing IOMMU properties")
--- .../devicetree/bindings/pci/rcar-pci-host.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/pci/rcar-pci-host.yaml +11 -0
@@ -68,6 +68,15 @@ properties: phy-names: const: pcie + vpcie1v5-supply: + description: The 1.5v regulator to use for PCIe. + + vpcie3v3-supply: + description: The 3.3v regulator to use for PCIe. + + vpcie12v-supply: + description: The 12v regulator to use for PCIe. + required: - compatible - reg
@@ -121,5 +130,7 @@ examples: clock-names = "pcie", "pcie_bus"; power-domains = <&sysc R8A7791_PD_ALWAYS_ON>; resets = <&cpg 319>; + vpcie3v3-supply = <&pcie_3v3>; + vpcie12v-supply = <&pcie_12v>; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 306/473 dt-bindings: PCI: rcar-pci-host: Add missing IOMMU properties
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 78d212851f0e56b7d7083c4d5014aa7fa8b77e20 ]
make dtbs_check:
arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb: pcie@fe000000: Unevaluated properties are not allowed ('iommu-map', 'iommu-map-mask' were unexpected)
from schema $id: http://devicetree.org/schemas/pci/rcar-pci-host.yaml#
Fix this by adding the missing IOMMU-related properties.
--- Documentation/devicetree/bindings/pci/rcar-pci-host.yaml | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/pci/rcar-pci-host.yaml +3 -0
@@ -77,6 +77,9 @@ properties: vpcie12v-supply: description: The 12v regulator to use for PCIe. + iommu-map: true + iommu-map-mask: true + required: - compatible - reg
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 307/473 f2fs: compress: fix to relocate check condition in f2fs_{release,reserve}_compress_blocks()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 7c5dffb3d90c5921b91981cc663e02757d90526e ]
Compress flag should be checked after inode lock held to avoid racing w/ f2fs_setflags_common(), fix it.
--- fs/f2fs/file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/f2fs/file.c +4 -8
@@ -3468,9 +3468,6 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)if (!f2fs_sb_has_compression (sbi))return -EOPNOTSUPP ; -if (!f2fs_compressed_file (inode)) -return -EINVAL ; -if (f2fs_readonly (sbi->sb))return -EROFS ;
@@ -3489,7 +3486,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg) goto out; } -if (is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { +if (!f2fs_compressed_file (inode) || +is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { ret = -EINVAL ; goto out; }
@@ -3650,9 +3648,6 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)if (!f2fs_sb_has_compression (sbi))return -EOPNOTSUPP ; -if (!f2fs_compressed_file (inode)) -return -EINVAL ; -if (f2fs_readonly (sbi->sb))return -EROFS ;
@@ -3664,7 +3659,8 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)inode_lock (inode); -if (!is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { +if (!f2fs_compressed_file (inode) || + !is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { ret = -EINVAL ; goto unlock_inode; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 308/473 f2fs: compress: fix to relocate check condition in f2fs_ioc_{,de}compress_file()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit bd9ae4ae9e585061acfd4a169f2321706f900246 ]
Compress flag should be checked after inode lock held to avoid racing w/ f2fs_setflags_common() , fix it.
--- fs/f2fs/file.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
fs/f2fs/file.c +4 -8
@@ -4064,9 +4064,6 @@ static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg)if (!(filp->f_mode &FMODE_WRITE ))return -EBADF ; -if (!f2fs_compressed_file (inode)) -return -EINVAL ; -f2fs_balance_fs (sbi, true);file_start_write (filp);
@@ -4077,7 +4074,8 @@ static int f2fs_ioc_decompress_file(struct file *filp, unsigned long arg) goto out; } -if (is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { +if (!f2fs_compressed_file (inode) || +is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { ret = -EINVAL ; goto out; }
@@ -4136,9 +4134,6 @@ static int f2fs_ioc_compress_file(struct file *filp, unsigned long arg)if (!(filp->f_mode &FMODE_WRITE ))return -EBADF ; -if (!f2fs_compressed_file (inode)) -return -EINVAL ; -f2fs_balance_fs (sbi, true);file_start_write (filp);
@@ -4149,7 +4144,8 @@ static int f2fs_ioc_compress_file(struct file *filp, unsigned long arg) goto out; } -if (is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { +if (!f2fs_compressed_file (inode) || +is_inode_flag_set (inode,FI_COMPRESS_RELEASED )) { ret = -EINVAL ; goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 309/473 f2fs: fix typos in comments
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinyoung CHOI <[email protected]>
[ Upstream commit 146949defda868378992171b9e42318b06fcd482 ]
This patch is to fix typos in f2fs files.
Stable-dep-of: 278a6253a673 ("f2fs: fix to relocate check condition in f2fs_fallocate()")
--- fs/f2fs/checkpoint.c | 4 ++-- fs/f2fs/compress.c | 2 +- fs/f2fs/data.c | 8 ++++---- fs/f2fs/extent_cache.c | 4 ++-- fs/f2fs/file.c | 6 +++--- fs/f2fs/namei.c | 2 +- fs/f2fs/segment.c | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-)
fs/f2fs/checkpoint.c +2 -2
@@ -797,7 +797,7 @@ static void write_orphan_inodes(struct f2fs_sb_info *sbi, block_t start_blk)*/ head = &im->ino_list; -/* loop for each orphan inode entry and write them in Jornal block */ +/* loop for each orphan inode entry and write them in journal block */ list_for_each_entry (orphan, head, list) {if (!page) { page =f2fs_grab_meta_page (sbi, start_blk++);
@@ -1127,7 +1127,7 @@ int f2fs_sync_dirty_inodes(struct f2fs_sb_info *sbi, enum inode_type type, }else {/* * We should submit bio, since it exists several -* wribacking dentry pages in the freeing inode. +* writebacking dentry pages in the freeing inode. */ f2fs_submit_merged_write (sbi,DATA );cond_resched ();
fs/f2fs/compress.c +1 -1
@@ -1264,7 +1264,7 @@ static int f2fs_write_compressed_pages(struct compress_ctx *cc,int i, err;bool quota_inode =IS_NOQUOTA (inode); -/* we should bypass data pages to proceed the kworkder jobs */ +/* we should bypass data pages to proceed the kworker jobs */ if (unlikely (f2fs_cp_error (sbi))) {mapping_set_error (cc->rpages[0 ]->mapping, -EIO ); goto out_free;
fs/f2fs/data.c +4 -4
@@ -2363,7 +2363,7 @@ static int f2fs_mpage_readpages(struct inode *inode,#ifdef CONFIG_F2FS_FS_COMPRESSION if (f2fs_compressed_file (inode)) { -/* there are remained comressed pages, submit them */ +/* there are remained compressed pages, submit them */ if (!f2fs_cluster_can_merge_page (&cc, page->index)) { ret = f2fs_read_multi_pages(&cc, &bio, max_nr_pages,
@@ -2779,7 +2779,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted,trace_f2fs_writepage (page,DATA ); -/* we should bypass data pages to proceed the kworkder jobs */ +/* we should bypass data pages to proceed the kworker jobs */ if (unlikely (f2fs_cp_error (sbi))) {mapping_set_error (page->mapping, -EIO );/*
@@ -2898,7 +2898,7 @@ int f2fs_write_single_data_page(struct page *page, int *submitted, redirty_out:redirty_page_for_writepage (wbc, page);/* -* pageout() in MM traslates EAGAIN, so calls handle_write_error() +* pageout() in MM translates EAGAIN, so calls handle_write_error() * -> mapping_set_error() -> set_bit(AS_EIO, ...). * file_write_and_wait_range() will see EIO error, which is critical * to return value of fsync() followed by atomic_write failure to user.
@@ -2932,7 +2932,7 @@ static int f2fs_write_data_page(struct page *page, }/* -* This function was copied from write_cche_pages from mm/page-writeback.c. +* This function was copied from write_cache_pages from mm/page-writeback.c. * The major change is making write step of cold data page separately from * warm/hot data page. */
fs/f2fs/extent_cache.c +2 -2
@@ -205,7 +205,7 @@ struct rb_node **f2fs_lookup_rb_tree_for_insert(struct f2fs_sb_info *sbi,* @prev_ex: extent before ofs * @next_ex: extent after ofs * @insert_p: insert point for new extent at ofs -* in order to simpfy the insertion after. +* in order to simplify the insertion after. * tree must stay unchanged between lookup and insertion. */ struct rb_entry *f2fs_lookup_rb_tree_ret(struct rb_root_cached *root,
@@ -662,7 +662,7 @@ static void __update_extent_tree_range(struct inode *inode,if (!en) en = next_en; -/* 2. invlidate all extent nodes in range [fofs, fofs + len - 1] */ +/* 2. invalidate all extent nodes in range [fofs, fofs + len - 1] */ while (en && en->ei.fofs < end) {unsigned int org_end;int parts =0 ;/* # of parts current extent split into */
fs/f2fs/file.c +3 -3
@@ -305,7 +305,7 @@ static int f2fs_do_sync_file(struct file *file, loff_t start, loff_t end,* for OPU case, during fsync(), node can be persisted before * data when lower device doesn't support write barrier, result * in data corruption after SPO. -* So for strict fsync mode, force to use atomic write sematics +* So for strict fsync mode, force to use atomic write semantics * to keep write order in between data/node and last node to * avoid potential data corruption. */
@@ -1805,7 +1805,7 @@ static long f2fs_fallocate(struct file *file, int mode,return -EOPNOTSUPP ;/* -* Pinned file should not support partial trucation since the block +* Pinned file should not support partial truncation since the block * can be used by applications. */ if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
@@ -1855,7 +1855,7 @@ static long f2fs_fallocate(struct file *file, int mode,static int f2fs_release_file (struct inode *inode,struct file *filp) {/* -* f2fs_relase_file is called at every close calls. So we should +* f2fs_release_file is called at every close calls. So we should * not drop any inmemory pages by close called by other process. */ if (!(filp->f_mode & FMODE_WRITE) ||
fs/f2fs/namei.c +1 -1
@@ -970,7 +970,7 @@ static int f2fs_rename(struct user_namespace *mnt_userns, struct inode *old_dir,/* * If new_inode is null, the below renaming flow will -* add a link in old_dir which can conver inline_dir. +* add a link in old_dir which can convert inline_dir. * After then, if we failed to get the entry due to other * reasons like ENOMEM, we had to remove the new entry. * Instead of adding such the error handling routine, let's
fs/f2fs/segment.c +1 -1
@@ -3615,7 +3615,7 @@ void f2fs_wait_on_page_writeback(struct page *page,/* submit cached LFS IO */ f2fs_submit_merged_write_cond (sbi,NULL , page,0 , type); -/* sbumit cached IPU IO */ +/* submit cached IPU IO */ f2fs_submit_merged_ipu_write (sbi,NULL , page);if (ordered) {wait_on_page_writeback (page);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 310/473 f2fs: fix to relocate check condition in f2fs_fallocate()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 278a6253a673611dbc8ab72a3b34b151a8e75822 ]
compress and pinfile flag should be checked after inode lock held to avoid race condition, fix it.
--- fs/f2fs/file.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
fs/f2fs/file.c +11 -9
@@ -1804,15 +1804,6 @@ static long f2fs_fallocate(struct file *file, int mode, (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))return -EOPNOTSUPP ; -/* -* Pinned file should not support partial truncation since the block -* can be used by applications. -*/ -if ((f2fs_compressed_file (inode) ||f2fs_is_pinned_file (inode)) && - (mode & (FALLOC_FL_PUNCH_HOLE |FALLOC_FL_COLLAPSE_RANGE | -FALLOC_FL_ZERO_RANGE |FALLOC_FL_INSERT_RANGE ))) -return -EOPNOTSUPP ; -if (mode & ~(FALLOC_FL_KEEP_SIZE |FALLOC_FL_PUNCH_HOLE |FALLOC_FL_COLLAPSE_RANGE |FALLOC_FL_ZERO_RANGE |FALLOC_FL_INSERT_RANGE ))
@@ -1820,6 +1811,17 @@ static long f2fs_fallocate(struct file *file, int mode,inode_lock (inode); +/* +* Pinned file should not support partial truncation since the block +* can be used by applications. +*/ +if ((f2fs_compressed_file (inode) ||f2fs_is_pinned_file (inode)) && + (mode & (FALLOC_FL_PUNCH_HOLE |FALLOC_FL_COLLAPSE_RANGE | +FALLOC_FL_ZERO_RANGE |FALLOC_FL_INSERT_RANGE ))) { + ret = -EOPNOTSUPP ; + goto out; + } + ret =file_modified (file);if (ret) goto out;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 311/473 f2fs: fix to check pinfile flag in f2fs_move_file_range()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit e07230da0500e0919a765037c5e81583b519be2c ]
ioctl(F2FS_IOC_MOVE_RANGE) can truncate or punch hole on pinned file, fix to disallow it.
--- fs/f2fs/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/f2fs/file.c +2 -1
@@ -2816,7 +2816,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, goto out; } -if (f2fs_compressed_file (src) ||f2fs_compressed_file (dst)) { +if (f2fs_compressed_file (src) ||f2fs_compressed_file (dst) || +f2fs_is_pinned_file (src) ||f2fs_is_pinned_file (dst)) { ret = -EOPNOTSUPP ; goto out_unlock; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 312/473 iio: adc: stm32: Fixing err code to not indicate success
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan Cameron <[email protected]>
[ Upstream commit 3735ca0b072656c3aa2cedc617a5e639b583a472 ]
This path would result in returning 0 / success on an error path.
--- drivers/iio/adc/stm32-adc.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/stm32-adc.c +1 -0
@@ -2079,6 +2079,7 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,if (vin[0 ] != val || vin[1 ] >= adc_info->max_channels) {dev_err (&indio_dev->dev,"Invalid channel in%d-in%d\n" , vin[0 ], vin[1 ]); + ret = -EINVAL ; goto err; } }else if (ret != -EINVAL ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 313/473 coresight: etm4x: Fix unbalanced pm_runtime_enable()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anshuman Khandual <[email protected]>
[ Upstream commit caa41c47dab7e1054f587e592ab21296e3a6781c ]
There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev() when etm4_probe() fails. This problem can be observed via the coresight etm4 module's (load -> unload -> load) sequence when etm4_probe() fails in etm4_probe_platform_dev().
[ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable! [ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable! [ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable! [ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable! [ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable! [ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable! [ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable! [ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable!
This fixes the above problem - with an explicit pm_runtime_disable() call when etm4_probe() fails during etm4_probe_platform_dev().
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hwtracing/coresight/coresight-etm4x-core.c +3 -0
@@ -2053,6 +2053,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev) ret =etm4_probe (&pdev->dev,NULL ,0 );pm_runtime_put (&pdev->dev); +if (ret) +pm_runtime_disable (&pdev->dev); +return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 314/473 perf docs: Document bpf event modifier
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit eb4d27cf9aef3e6c9bcaf8fa1a1cadc2433d847b ]
Document that 'b' is used as a modifier to make an event use a BPF counter.
--- tools/perf/Documentation/perf-list.txt | 1 + 1 file changed, 1 insertion(+)
tools/perf/Documentation/perf-list.txt +1 -0
@@ -63,6 +63,7 @@ counted. The following modifiers exist: D - pin the event to the PMU W - group is weak and will fallback to non-group if not schedulable, e - group or event are exclusive and do not share the PMU + b - use BPF aggregration (see perf stat --bpf-counters) The 'p' modifier can be used for specifying how precise the instruction address should be. The 'p' modifier can be specified multiple times:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 315/473 iio: pressure: dps310: support negative temperature values
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Haemmerle <[email protected]>
[ Upstream commit 9dd6b32e76ff714308964cd9ec91466a343dcb8b ]
The current implementation interprets negative values returned from dps310_calculate_temp as error codes.
This has a side effect that when negative temperature values are calculated, they are interpreted as error.
Fix this by using the return value only for error handling and passing a pointer for the value.
--- drivers/iio/pressure/dps310.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/iio/pressure/dps310.c +6 -5
@@ -730,7 +730,7 @@ static int dps310_read_pressure(struct dps310_data *data, int *val, int *val2, } } -static int dps310_calculate_temp (struct dps310_data *data) +static int dps310_calculate_temp (struct dps310_data *data,int *val) {s64 c0;s64 t;
@@ -746,7 +746,9 @@ static int dps310_calculate_temp(struct dps310_data *data) t = c0 + ((s64 )data->temp_raw * (s64 )data->c1);/* Convert to milliCelsius and scale the temperature */ -return (int )div_s64 (t *1000LL , kt); + *val = (int )div_s64 (t *1000LL , kt); + +return 0 ; } static int dps310_read_temp(struct dps310_data *data, int *val, int *val2,
@@ -768,11 +770,10 @@ static int dps310_read_temp(struct dps310_data *data, int *val, int *val2,if (rc)return rc; - rc =dps310_calculate_temp (data); -if (rc <0 ) + rc =dps310_calculate_temp (data, val); +if (rc)return rc; - *val = rc;return IIO_VAL_INT ;case IIO_CHAN_INFO_OVERSAMPLING_RATIO :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 316/473 coresight: etm4x: Do not hardcode IOMEM access for register restore
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suzuki K Poulose <[email protected]>
[ Upstream commit 1e7ba33fa591de1cf60afffcabb45600b3607025 ]
When we restore the register state for ETM4x, while coming back from CPU idle, we hardcode IOMEM access. This is wrong and could blow up for an ETM with system instructions access (and for ETE).
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +4 -2
@@ -1726,8 +1726,10 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata) {int i;struct etmv4_save_state *state = drvdata->save_state; -struct csdev_access tmp_csa =CSDEV_ACCESS_IOMEM (drvdata->base); -struct csdev_access *csa = &tmp_csa; +struct csdev_access *csa = &drvdata->csdev->access; + +if (WARN_ON (!drvdata->csdev)) +return ;etm4_cs_unlock (drvdata, csa);etm4x_relaxed_write32 (csa, state->trcclaimset,TRCCLAIMSET );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 317/473 coresight: etm4x: Do not save/restore Data trace control registers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suzuki K Poulose <[email protected]>
[ Upstream commit 5eb3a0c2c52368cb9902e9a6ea04888e093c487d ]
ETM4x doesn't support Data trace on A class CPUs. As such do not access the Data trace control registers during CPU idle. This could cause problems for ETE. While at it, remove all references to the Data trace control registers.
--- .../coresight/coresight-etm4x-core.c | 6 ---- drivers/hwtracing/coresight/coresight-etm4x.h | 28 ------------------- 2 files changed, 34 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +0 -6
@@ -1622,9 +1622,6 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcvissctlr =etm4x_read32 (csa,TRCVISSCTLR );if (drvdata->nr_pe_cmp) state->trcvipcssctlr =etm4x_read32 (csa,TRCVIPCSSCTLR ); - state->trcvdctlr =etm4x_read32 (csa,TRCVDCTLR ); - state->trcvdsacctlr =etm4x_read32 (csa,TRCVDSACCTLR ); - state->trcvdarcctlr =etm4x_read32 (csa,TRCVDARCCTLR );for (i =0 ; i < drvdata->nrseqstate -1 ; i++) state->trcseqevr[i] =etm4x_read32 (csa,TRCSEQEVRn (i));
@@ -1755,9 +1752,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)etm4x_relaxed_write32 (csa, state->trcvissctlr,TRCVISSCTLR );if (drvdata->nr_pe_cmp)etm4x_relaxed_write32 (csa, state->trcvipcssctlr,TRCVIPCSSCTLR ); -etm4x_relaxed_write32 (csa, state->trcvdctlr,TRCVDCTLR ); -etm4x_relaxed_write32 (csa, state->trcvdsacctlr,TRCVDSACCTLR ); -etm4x_relaxed_write32 (csa, state->trcvdarcctlr,TRCVDARCCTLR );for (i =0 ; i < drvdata->nrseqstate -1 ; i++)etm4x_relaxed_write32 (csa, state->trcseqevr[i],TRCSEQEVRn (i));
drivers/hwtracing/coresight/coresight-etm4x.h +0 -28
@@ -43,9 +43,6 @@#define TRCVIIECTLR 0x084#define TRCVISSCTLR 0x088#define TRCVIPCSSCTLR 0x08C -#define TRCVDCTLR 0x0A0 -#define TRCVDSACCTLR 0x0A4 -#define TRCVDARCCTLR 0x0A8/* Derived resources registers */ #define TRCSEQEVRn (n) (0x100 + (n * 4))/* n = 0-2 */ #define TRCSEQRSTEVR 0x118
@@ -90,9 +87,6 @@/* Address Comparator registers n = 0-15 */ #define TRCACVRn (n) (0x400 + (n * 8))#define TRCACATRn (n) (0x480 + (n * 8)) -/* Data Value Comparator Value registers, n = 0-7 */ -#define TRCDVCVRn (n) (0x500 + (n * 16)) -#define TRCDVCMRn (n) (0x580 + (n * 16))/* ContextID/Virtual ContextID comparators, n = 0-7 */ #define TRCCIDCVRn (n) (0x600 + (n * 8))#define TRCVMIDCVRn (n) (0x640 + (n * 8))
@@ -272,9 +266,6 @@/* List of registers accessible via System instructions */ #define ETM4x_ONLY_SYSREG_LIST (op, val) \ CASE_##op((val), TRCPROCSELR) \ - CASE_##op((val), TRCVDCTLR) \ - CASE_##op((val), TRCVDSACCTLR) \ - CASE_##op((val), TRCVDARCCTLR) \ CASE_##op((val), TRCOSLAR)#define ETM_COMMON_SYSREG_LIST (op, val) \
@@ -422,22 +413,6 @@ CASE_##op((val), TRCACATRn(13)) \ CASE_##op((val), TRCACATRn(14)) \ CASE_##op((val), TRCACATRn(15)) \ - CASE_##op((val), TRCDVCVRn(0)) \ - CASE_##op((val), TRCDVCVRn(1)) \ - CASE_##op((val), TRCDVCVRn(2)) \ - CASE_##op((val), TRCDVCVRn(3)) \ - CASE_##op((val), TRCDVCVRn(4)) \ - CASE_##op((val), TRCDVCVRn(5)) \ - CASE_##op((val), TRCDVCVRn(6)) \ - CASE_##op((val), TRCDVCVRn(7)) \ - CASE_##op((val), TRCDVCMRn(0)) \ - CASE_##op((val), TRCDVCMRn(1)) \ - CASE_##op((val), TRCDVCMRn(2)) \ - CASE_##op((val), TRCDVCMRn(3)) \ - CASE_##op((val), TRCDVCMRn(4)) \ - CASE_##op((val), TRCDVCMRn(5)) \ - CASE_##op((val), TRCDVCMRn(6)) \ - CASE_##op((val), TRCDVCMRn(7)) \ CASE_##op((val), TRCCIDCVRn(0)) \ CASE_##op((val), TRCCIDCVRn(1)) \ CASE_##op((val), TRCCIDCVRn(2)) \
@@ -905,9 +880,6 @@ struct etmv4_save_state {u32 trcviiectlr;u32 trcvissctlr;u32 trcvipcssctlr; -u32 trcvdctlr; -u32 trcvdsacctlr; -u32 trcvdarcctlr;u32 trcseqevr[ETM_MAX_SEQ_STATES ];u32 trcseqrstevr;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 318/473 coresight: etm4x: Safe access for TRCQCLTR
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suzuki K Poulose <[email protected]>
[ Upstream commit 46bf8d7cd8530eca607379033b9bc4ac5590a0cd ]
ETM4x implements TRCQCLTR only when the Q elements are supported and the Q element filtering is supported (TRCIDR0.QFILT). Access to the register otherwise could be fatal. Fix this by tracking the availability, like the others.
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 8 ++++++-- drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +6 -2
@@ -1120,6 +1120,8 @@ static void etm4_init_arch_data(void *info) drvdata->nr_event =FIELD_GET (TRCIDR0_NUMEVENT_MASK , etmidr0);/* QSUPP, bits[16:15] Q element support field */ drvdata->q_support =FIELD_GET (TRCIDR0_QSUPP_MASK , etmidr0); +if (drvdata->q_support) + drvdata->q_filt = !!(etmidr0 &TRCIDR0_QFILT );/* TSSIZE, bits[28:24] Global timestamp size field */ drvdata->ts_size =FIELD_GET (TRCIDR0_TSSIZE_MASK , etmidr0);
@@ -1615,7 +1617,8 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trcccctlr =etm4x_read32 (csa,TRCCCCTLR ); state->trcbbctlr =etm4x_read32 (csa,TRCBBCTLR ); state->trctraceidr =etm4x_read32 (csa,TRCTRACEIDR ); - state->trcqctlr =etm4x_read32 (csa,TRCQCTLR ); +if (drvdata->q_filt) + state->trcqctlr =etm4x_read32 (csa,TRCQCTLR ); state->trcvictlr =etm4x_read32 (csa,TRCVICTLR ); state->trcviiectlr =etm4x_read32 (csa,TRCVIIECTLR );
@@ -1745,7 +1748,8 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)etm4x_relaxed_write32 (csa, state->trcccctlr,TRCCCCTLR );etm4x_relaxed_write32 (csa, state->trcbbctlr,TRCBBCTLR );etm4x_relaxed_write32 (csa, state->trctraceidr,TRCTRACEIDR ); -etm4x_relaxed_write32 (csa, state->trcqctlr,TRCQCTLR ); +if (drvdata->q_filt) +etm4x_relaxed_write32 (csa, state->trcqctlr,TRCQCTLR );etm4x_relaxed_write32 (csa, state->trcvictlr,TRCVICTLR );etm4x_relaxed_write32 (csa, state->trcviiectlr,TRCVIIECTLR );
drivers/hwtracing/coresight/coresight-etm4x.h +3 -0
@@ -135,6 +135,7 @@#define TRCIDR0_TRCCCI BIT(7)#define TRCIDR0_RETSTACK BIT(9)#define TRCIDR0_NUMEVENT_MASK GENMASK(11, 10) +#define TRCIDR0_QFILT BIT(14)#define TRCIDR0_QSUPP_MASK GENMASK(16, 15)#define TRCIDR0_TSSIZE_MASK GENMASK(28, 24)
@@ -951,6 +952,7 @@ struct etmv4_save_state {* @os_unlock: True if access to management registers is allowed. * @instrp0: Tracing of load and store instructions * as P0 elements is supported. +* @q_filt: Q element filtering support, if Q elements are supported. * @trcbb: Indicates if the trace unit supports branch broadcast tracing. * @trccond: If the trace unit supports conditional * instruction tracing.
@@ -1013,6 +1015,7 @@ struct etmv4_drvdata {bool boot_enable;bool os_unlock;bool instrp0; +bool q_filt;bool trcbb;bool trccond;bool retstack;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 319/473 coresight: etm4x: Fix access to resource selector registers
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Suzuki K Poulose <[email protected]>
[ Upstream commit d6fc00d0f640d6010b51054aa8b0fd191177dbc9 ]
Resource selector pair 0 is always implemented and reserved. We must not touch it, even during save/restore for CPU Idle. Rest of the driver is well behaved. Fix the offending ones.
--- drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/hwtracing/coresight/coresight-etm4x-core.c +4 -2
@@ -1641,7 +1641,8 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata) state->trccntvr[i] =etm4x_read32 (csa,TRCCNTVRn (i)); } -for (i =0 ; i < drvdata->nr_resource *2 ; i++) +/* Resource selector pair 0 is reserved */ +for (i =2 ; i < drvdata->nr_resource *2 ; i++) state->trcrsctlr[i] =etm4x_read32 (csa,TRCRSCTLRn (i));for (i =0 ; i < drvdata->nr_ss_cmp; i++) {
@@ -1772,7 +1773,8 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)etm4x_relaxed_write32 (csa, state->trccntvr[i],TRCCNTVRn (i)); } -for (i =0 ; i < drvdata->nr_resource *2 ; i++) +/* Resource selector pair 0 is reserved */ +for (i =2 ; i < drvdata->nr_resource *2 ; i++)etm4x_relaxed_write32 (csa, state->trcrsctlr[i],TRCRSCTLRn (i));for (i =0 ; i < drvdata->nr_ss_cmp; i++) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 320/473 fpga: region: add owner module and take its refcount
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Pagani <[email protected]>
[ Upstream commit b7c0e1ecee403a43abc89eb3e75672b01ff2ece9 ]
The current implementation of the fpga region assumes that the low-level module registers a driver for the parent device and uses its owner pointer to take the module's refcount. This approach is problematic since it can lead to a null pointer dereference while attempting to get the region during programming if the parent device does not have a driver.
To address this problem, add a module owner pointer to the fpga_region struct and use it to take the module's refcount. Modify the functions for registering a region to take an additional owner module parameter and rename them to avoid conflicts. Use the old function names for helper macros that automatically set the module that registers the region as the owner. This ensures compatibility with existing low-level control modules and reduces the chances of registering a region without setting the owner.
Also, update the documentation to keep it consistent with the new interface for registering an fpga region.
--- Documentation/driver-api/fpga/fpga-region.rst | 13 ++++++---- drivers/fpga/fpga-region.c | 24 +++++++++++-------- include/linux/fpga/fpga-region.h | 13 +++++++--- 3 files changed, 32 insertions(+), 18 deletions(-)
Documentation/driver-api/fpga/fpga-region.rst +8 -5
@@ -46,13 +46,16 @@ API to add a new FPGA region ---------------------------- * struct fpga_region - The FPGA region struct -* struct fpga_region_info - Parameter structure for fpga_region_register_full() -* fpga_region_register_full() - Create and register an FPGA region using the +* struct fpga_region_info - Parameter structure for __fpga_region_register_full() +* __fpga_region_register_full() - Create and register an FPGA region using the fpga_region_info structure to provide the full flexibility of options -* fpga_region_register() - Create and register an FPGA region using standard +* __fpga_region_register() - Create and register an FPGA region using standard arguments * fpga_region_unregister() - Unregister an FPGA region +Helper macros ``fpga_region_register()`` and ``fpga_region_register_full()`` +automatically set the module that registers the FPGA region as the owner. + The FPGA region's probe function will need to get a reference to the FPGA Manager it will be using to do the programming. This usually would happen during the region's probe function.
@@ -82,10 +85,10 @@ following APIs to handle building or tearing down that list. :functions: fpga_region_info .. kernel-doc:: drivers/fpga/fpga-region.c - :functions: fpga_region_register_full + :functions: __fpga_region_register_full .. kernel-doc:: drivers/fpga/fpga-region.c - :functions: fpga_region_register + :functions: __fpga_region_register .. kernel-doc:: drivers/fpga/fpga-region.c :functions: fpga_region_unregister
drivers/fpga/fpga-region.c +14 -10
@@ -52,7 +52,7 @@ static struct fpga_region *fpga_region_get(struct fpga_region *region) }get_device (dev); -if (!try_module_get (dev->parent->driver->owner)) { +if (!try_module_get (region->ops_owner)) {put_device (dev);mutex_unlock (®ion->mutex);return ERR_PTR (-ENODEV );
@@ -74,7 +74,7 @@ static void fpga_region_put(struct fpga_region *region)dev_dbg (dev,"put\n" ); -module_put (dev->parent->driver->owner); +module_put (region->ops_owner);put_device (dev);mutex_unlock (®ion->mutex); }
@@ -180,14 +180,16 @@ static struct attribute *fpga_region_attrs[] = {ATTRIBUTE_GROUPS (fpga_region);/** -* fpga_region_register_full - create and register an FPGA Region device +* __fpga_region_register_full - create and register an FPGA Region device * @parent: device parent * @info: parameters for FPGA Region +* @owner: module containing the get_bridges function * * Return: struct fpga_region or ERR_PTR() */ struct fpga_region * -fpga_region_register_full (struct device *parent,const struct fpga_region_info *info) +__fpga_region_register_full (struct device *parent,const struct fpga_region_info *info, +struct module *owner) {struct fpga_region *region;int id, ret =0 ;
@@ -212,6 +214,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info * region->compat_id = info->compat_id; region->priv = info->priv; region->get_bridges = info->get_bridges; + region->ops_owner = owner;mutex_init (®ion->mutex);INIT_LIST_HEAD (®ion->bridge_list);
@@ -240,13 +243,14 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info *return ERR_PTR (ret); } -EXPORT_SYMBOL_GPL (fpga_region_register_full); +EXPORT_SYMBOL_GPL (__fpga_region_register_full);/** -* fpga_region_register - create and register an FPGA Region device +* __fpga_region_register - create and register an FPGA Region device * @parent: device parent * @mgr: manager that programs this region * @get_bridges: optional function to get bridges to a list +* @owner: module containing the get_bridges function * * This simple version of the register function should be sufficient for most users. * The fpga_region_register_full() function is available for users that need to
@@ -255,17 +259,17 @@ EXPORT_SYMBOL_GPL(fpga_region_register_full);* Return: struct fpga_region or ERR_PTR() */ struct fpga_region * -fpga_region_register (struct device *parent,struct fpga_manager *mgr, -int (*get_bridges)(struct fpga_region *)) +__fpga_region_register (struct device *parent,struct fpga_manager *mgr, +int (*get_bridges)(struct fpga_region *),struct module *owner) {struct fpga_region_info info = {0 }; info.mgr = mgr; info.get_bridges = get_bridges; -return fpga_region_register_full (parent, &info); +return __fpga_region_register_full (parent, &info, owner); } -EXPORT_SYMBOL_GPL (fpga_region_register); +EXPORT_SYMBOL_GPL (__fpga_region_register);/** * fpga_region_unregister - unregister an FPGA region
include/linux/fpga/fpga-region.h +10 -3
@@ -36,6 +36,7 @@ struct fpga_region_info {* @mgr: FPGA manager * @info: FPGA image info * @compat_id: FPGA region id for compatibility check. +* @ops_owner: module containing the get_bridges function * @priv: private data * @get_bridges: optional function to get bridges to a list */
@@ -46,6 +47,7 @@ struct fpga_region {struct fpga_manager *mgr;struct fpga_image_info *info;struct fpga_compat_id *compat_id; +struct module *ops_owner;void *priv;int (*get_bridges)(struct fpga_region *region); };
@@ -58,12 +60,17 @@ fpga_region_class_find(struct device *start, const void *data,int fpga_region_program_fpga (struct fpga_region *region); +#define fpga_region_register_full (parent, info) \ + __fpga_region_register_full(parent, info, THIS_MODULE)struct fpga_region * -fpga_region_register_full (struct device *parent,const struct fpga_region_info *info); +__fpga_region_register_full (struct device *parent,const struct fpga_region_info *info, +struct module *owner); +#define fpga_region_register (parent, mgr, get_bridges) \ + __fpga_region_register(parent, mgr, get_bridges, THIS_MODULE)struct fpga_region * -fpga_region_register (struct device *parent,struct fpga_manager *mgr, -int (*get_bridges)(struct fpga_region *)); +__fpga_region_register (struct device *parent,struct fpga_manager *mgr, +int (*get_bridges)(struct fpga_region *),struct module *owner);void fpga_region_unregister (struct fpga_region *region);#endif /* _FPGA_REGION_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 321/473 microblaze: Remove gcc flag for non existing early_printk.c file
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit edc66cf0c4164aa3daf6cc55e970bb94383a6a57 ]
early_printk support for removed long time ago but compilation flag for ftrace still points to already removed file that's why remove that line too.
--- arch/microblaze/kernel/Makefile | 1 - 1 file changed, 1 deletion(-)
arch/microblaze/kernel/Makefile +0 -1
@@ -7,7 +7,6 @@ ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code and low level code CFLAGS_REMOVE_timer.o = -pg CFLAGS_REMOVE_intc.o = -pg -CFLAGS_REMOVE_early_printk.o = -pg CFLAGS_REMOVE_ftrace.o = -pg CFLAGS_REMOVE_process.o = -pg endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 322/473 microblaze: Remove early printk call from cpuinfo-static.c
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
[ Upstream commit 58d647506c92ccd3cfa0c453c68ddd14f40bf06f ]
Early printk has been removed already that's why also remove calling it. Similar change has been done in cpuinfo-pvr-full.c by commit cfbd8d1979af ("microblaze: Remove early printk setup").
--- arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/microblaze/kernel/cpu/cpuinfo-static.c +1 -1
@@ -18,7 +18,7 @@ static const char family_string[] = CONFIG_XILINX_MICROBLAZE0_FAMILY;static const char cpu_ver_string[] =CONFIG_XILINX_MICROBLAZE0_HW_VER ;#define err_printk (x) \ - early_printk("ERROR: Microblaze " x "-different for kernel and DTS\n"); + pr_err("ERROR: Microblaze " x "-different for kernel and DTS\n");void __init set_cpuinfo_static (struct cpuinfo *ci,struct device_node *cpu) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 323/473 perf intel-pt: Fix unassigned instruction op (discovered by MemorySanitizer)
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
[ Upstream commit e101a05f79fd4ee3e89d2f3fb716493c33a33708 ]
MemorySanitizer discovered instances where the instruction op value was not assigned.:
WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x5581c00a76b3 in intel_pt_sample_flags tools/perf/util/intel-pt.c:1527:17
Uninitialized value was stored to memory at
#0 0x5581c005ddf8 in intel_pt_walk_insn tools/perf/util/intel-pt-decoder/intel-pt-decoder.c:1256:25The op value is used to set branch flags for branch instructions encountered when walking the code, so fix by setting op to INTEL_PT_OP_OTHER in other cases.
--- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++ tools/perf/util/intel-pt.c | 2 ++ 2 files changed, 4 insertions(+)
tools/perf/util/intel-pt-decoder/intel-pt-decoder.c +2 -0
@@ -1319,6 +1319,8 @@ static bool intel_pt_fup_event(struct intel_pt_decoder *decoder, bool no_tip)bool ret = false; decoder->state.type &= ~INTEL_PT_BRANCH ; + decoder->state.insn_op =INTEL_PT_OP_OTHER ; + decoder->state.insn_len =0 ;if (decoder->set_fup_cfe_ip || decoder->set_fup_cfe) {bool ip = decoder->set_fup_cfe_ip;
tools/perf/util/intel-pt.c +2 -0
@@ -755,6 +755,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn,bool nr; intel_pt_insn->length =0 ; + intel_pt_insn->op =INTEL_PT_OP_OTHER ;if (to_ip && *ip == to_ip) goto out_no_cache;
@@ -876,6 +877,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn,if (to_ip && *ip == to_ip) { intel_pt_insn->length =0 ; + intel_pt_insn->op =INTEL_PT_OP_OTHER ; goto out_no_cache; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 324/473 ovl: remove upper umask handling from ovl_create_upper()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miklos Szeredi <[email protected]>
[ Upstream commit 096802748ea1dea8b476938e0a8dc16f4bd2f1ad ]
This is already done by vfs_prepare_mode() when creating the upper object by vfs_create(), vfs_mkdir() and vfs_mknod().
No regressions have been observed in xfstests run with posix acls turned off for the upper filesystem.
--- fs/overlayfs/dir.c | 3 --- 1 file changed, 3 deletions(-)
fs/overlayfs/dir.c +0 -3
@@ -327,9 +327,6 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,struct dentry *newdentry;int err; -if (!attr->hardlink && !IS_POSIXACL (udir)) - attr->mode &= ~current_umask (); -inode_lock_nested (udir,I_MUTEX_PARENT ); newdentry = ovl_create_real(ofs, udir, ovl_lookup_upper(ofs, dentry->d_name.name,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 325/473 VMCI: Fix an error handling path in vmci_guest_probe_device()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 73df3d6f2e9533e93a5039a33c40dd7216b81801 ]
After a successful pci_iomap_range() call, pci_iounmap() should be called in the error handling path, as already done in the remove function.
Add the missing call.
The corresponding call was added in the remove function in commit 5ee109828e73 ("VMCI: dma dg: allocate send and receive buffers for DMA datagrams")
--- drivers/misc/vmw_vmci/vmci_guest.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/misc/vmw_vmci/vmci_guest.c +8 -2
@@ -625,7 +625,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,if (!vmci_dev) {dev_err (&pdev->dev,"Can't allocate memory for VMCI device\n" ); -return -ENOMEM ; + error = -ENOMEM ; + goto err_unmap_mmio_base; } vmci_dev->dev = &pdev->dev;
@@ -642,7 +643,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,if (!vmci_dev->tx_buffer) {dev_err (&pdev->dev,"Can't allocate memory for datagram tx buffer\n" ); -return -ENOMEM ; + error = -ENOMEM ; + goto err_unmap_mmio_base; } vmci_dev->data_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE,
@@ -893,6 +895,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev, err_free_data_buffers:vmci_free_dg_buffers (vmci_dev); +err_unmap_mmio_base: +if (mmio_base !=NULL ) +pci_iounmap (pdev, mmio_base); +/* The rest are managed resources and will be freed by PCI core */ return error; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 326/473 dt-bindings: pinctrl: mediatek: mt7622: fix array properties
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rafał Miłecki <[email protected]>
[ Upstream commit 61fcbbf3ca038c048c942ce31bb3d3c846c87581 ]
Some properties (function groups & pins) are meant to be arrays and should allow multiple entries out of enum sets. Use "items" for those.
Mistake was noticed during validation of in-kernel DTS files.
Message-ID: <[email protected]>
--- .../pinctrl/mediatek,mt7622-pinctrl.yaml | 92 ++++++++++--------- 1 file changed, 49 insertions(+), 43 deletions(-)
Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml +49 -43
@@ -97,7 +97,8 @@ patternProperties: then: properties: groups: - enum: [emmc, emmc_rst] + items: + enum: [emmc, emmc_rst] - if: properties: function:
@@ -105,8 +106,9 @@ patternProperties: then: properties: groups: - enum: [esw, esw_p0_p1, esw_p2_p3_p4, rgmii_via_esw, - rgmii_via_gmac1, rgmii_via_gmac2, mdc_mdio] + items: + enum: [esw, esw_p0_p1, esw_p2_p3_p4, rgmii_via_esw, + rgmii_via_gmac1, rgmii_via_gmac2, mdc_mdio] - if: properties: function:
@@ -123,10 +125,11 @@ patternProperties: then: properties: groups: - enum: [i2s_in_mclk_bclk_ws, i2s1_in_data, i2s2_in_data, - i2s3_in_data, i2s4_in_data, i2s_out_mclk_bclk_ws, - i2s1_out_data, i2s2_out_data, i2s3_out_data, - i2s4_out_data] + items: + enum: [i2s_in_mclk_bclk_ws, i2s1_in_data, i2s2_in_data, + i2s3_in_data, i2s4_in_data, i2s_out_mclk_bclk_ws, + i2s1_out_data, i2s2_out_data, i2s3_out_data, + i2s4_out_data] - if: properties: function:
@@ -159,10 +162,11 @@ patternProperties: then: properties: groups: - enum: [pcie0_0_waken, pcie0_1_waken, pcie1_0_waken, - pcie0_0_clkreq, pcie0_1_clkreq, pcie1_0_clkreq, - pcie0_pad_perst, pcie1_pad_perst, pcie_pereset, - pcie_wake, pcie_clkreq] + items: + enum: [pcie0_0_waken, pcie0_1_waken, pcie1_0_waken, + pcie0_0_clkreq, pcie0_1_clkreq, pcie1_0_clkreq, + pcie0_pad_perst, pcie1_pad_perst, pcie_pereset, + pcie_wake, pcie_clkreq] - if: properties: function:
@@ -178,11 +182,12 @@ patternProperties: then: properties: groups: - enum: [pwm_ch1_0, pwm_ch1_1, pwm_ch1_2, pwm_ch2_0, pwm_ch2_1, - pwm_ch2_2, pwm_ch3_0, pwm_ch3_1, pwm_ch3_2, pwm_ch4_0, - pwm_ch4_1, pwm_ch4_2, pwm_ch4_3, pwm_ch5_0, pwm_ch5_1, - pwm_ch5_2, pwm_ch6_0, pwm_ch6_1, pwm_ch6_2, pwm_ch6_3, - pwm_ch7_0, pwm_0, pwm_1] + items: + enum: [pwm_ch1_0, pwm_ch1_1, pwm_ch1_2, pwm_ch2_0, pwm_ch2_1, + pwm_ch2_2, pwm_ch3_0, pwm_ch3_1, pwm_ch3_2, pwm_ch4_0, + pwm_ch4_1, pwm_ch4_2, pwm_ch4_3, pwm_ch5_0, pwm_ch5_1, + pwm_ch5_2, pwm_ch6_0, pwm_ch6_1, pwm_ch6_2, pwm_ch6_3, + pwm_ch7_0, pwm_0, pwm_1] - if: properties: function:
@@ -260,33 +265,34 @@ patternProperties: pins: description: | An array of strings. Each string contains the name of a pin. - enum: [GPIO_A, I2S1_IN, I2S1_OUT, I2S_BCLK, I2S_WS, I2S_MCLK, TXD0, - RXD0, SPI_WP, SPI_HOLD, SPI_CLK, SPI_MOSI, SPI_MISO, SPI_CS, - I2C_SDA, I2C_SCL, I2S2_IN, I2S3_IN, I2S4_IN, I2S2_OUT, - I2S3_OUT, I2S4_OUT, GPIO_B, MDC, MDIO, G2_TXD0, G2_TXD1, - G2_TXD2, G2_TXD3, G2_TXEN, G2_TXC, G2_RXD0, G2_RXD1, G2_RXD2, - G2_RXD3, G2_RXDV, G2_RXC, NCEB, NWEB, NREB, NDL4, NDL5, NDL6, - NDL7, NRB, NCLE, NALE, NDL0, NDL1, NDL2, NDL3, MDI_TP_P0, - MDI_TN_P0, MDI_RP_P0, MDI_RN_P0, MDI_TP_P1, MDI_TN_P1, - MDI_RP_P1, MDI_RN_P1, MDI_RP_P2, MDI_RN_P2, MDI_TP_P2, - MDI_TN_P2, MDI_TP_P3, MDI_TN_P3, MDI_RP_P3, MDI_RN_P3, - MDI_RP_P4, MDI_RN_P4, MDI_TP_P4, MDI_TN_P4, PMIC_SCL, - PMIC_SDA, SPIC1_CLK, SPIC1_MOSI, SPIC1_MISO, SPIC1_CS, - GPIO_D, WATCHDOG, RTS3_N, CTS3_N, TXD3, RXD3, PERST0_N, - PERST1_N, WLED_N, EPHY_LED0_N, AUXIN0, AUXIN1, AUXIN2, - AUXIN3, TXD4, RXD4, RTS4_N, CST4_N, PWM1, PWM2, PWM3, PWM4, - PWM5, PWM6, PWM7, GPIO_E, TOP_5G_CLK, TOP_5G_DATA, - WF0_5G_HB0, WF0_5G_HB1, WF0_5G_HB2, WF0_5G_HB3, WF0_5G_HB4, - WF0_5G_HB5, WF0_5G_HB6, XO_REQ, TOP_RST_N, SYS_WATCHDOG, - EPHY_LED0_N_JTDO, EPHY_LED1_N_JTDI, EPHY_LED2_N_JTMS, - EPHY_LED3_N_JTCLK, EPHY_LED4_N_JTRST_N, WF2G_LED_N, - WF5G_LED_N, GPIO_9, GPIO_10, GPIO_11, GPIO_12, UART1_TXD, - UART1_RXD, UART1_CTS, UART1_RTS, UART2_TXD, UART2_RXD, - UART2_CTS, UART2_RTS, SMI_MDC, SMI_MDIO, PCIE_PERESET_N, - PWM_0, GPIO_0, GPIO_1, GPIO_2, GPIO_3, GPIO_4, GPIO_5, - GPIO_6, GPIO_7, GPIO_8, UART0_TXD, UART0_RXD, TOP_2G_CLK, - TOP_2G_DATA, WF0_2G_HB0, WF0_2G_HB1, WF0_2G_HB2, WF0_2G_HB3, - WF0_2G_HB4, WF0_2G_HB5, WF0_2G_HB6] + items: + enum: [GPIO_A, I2S1_IN, I2S1_OUT, I2S_BCLK, I2S_WS, I2S_MCLK, TXD0, + RXD0, SPI_WP, SPI_HOLD, SPI_CLK, SPI_MOSI, SPI_MISO, SPI_CS, + I2C_SDA, I2C_SCL, I2S2_IN, I2S3_IN, I2S4_IN, I2S2_OUT, + I2S3_OUT, I2S4_OUT, GPIO_B, MDC, MDIO, G2_TXD0, G2_TXD1, + G2_TXD2, G2_TXD3, G2_TXEN, G2_TXC, G2_RXD0, G2_RXD1, G2_RXD2, + G2_RXD3, G2_RXDV, G2_RXC, NCEB, NWEB, NREB, NDL4, NDL5, NDL6, + NDL7, NRB, NCLE, NALE, NDL0, NDL1, NDL2, NDL3, MDI_TP_P0, + MDI_TN_P0, MDI_RP_P0, MDI_RN_P0, MDI_TP_P1, MDI_TN_P1, + MDI_RP_P1, MDI_RN_P1, MDI_RP_P2, MDI_RN_P2, MDI_TP_P2, + MDI_TN_P2, MDI_TP_P3, MDI_TN_P3, MDI_RP_P3, MDI_RN_P3, + MDI_RP_P4, MDI_RN_P4, MDI_TP_P4, MDI_TN_P4, PMIC_SCL, + PMIC_SDA, SPIC1_CLK, SPIC1_MOSI, SPIC1_MISO, SPIC1_CS, + GPIO_D, WATCHDOG, RTS3_N, CTS3_N, TXD3, RXD3, PERST0_N, + PERST1_N, WLED_N, EPHY_LED0_N, AUXIN0, AUXIN1, AUXIN2, + AUXIN3, TXD4, RXD4, RTS4_N, CST4_N, PWM1, PWM2, PWM3, PWM4, + PWM5, PWM6, PWM7, GPIO_E, TOP_5G_CLK, TOP_5G_DATA, + WF0_5G_HB0, WF0_5G_HB1, WF0_5G_HB2, WF0_5G_HB3, WF0_5G_HB4, + WF0_5G_HB5, WF0_5G_HB6, XO_REQ, TOP_RST_N, SYS_WATCHDOG, + EPHY_LED0_N_JTDO, EPHY_LED1_N_JTDI, EPHY_LED2_N_JTMS, + EPHY_LED3_N_JTCLK, EPHY_LED4_N_JTRST_N, WF2G_LED_N, + WF5G_LED_N, GPIO_9, GPIO_10, GPIO_11, GPIO_12, UART1_TXD, + UART1_RXD, UART1_CTS, UART1_RTS, UART2_TXD, UART2_RXD, + UART2_CTS, UART2_RTS, SMI_MDC, SMI_MDIO, PCIE_PERESET_N, + PWM_0, GPIO_0, GPIO_1, GPIO_2, GPIO_3, GPIO_4, GPIO_5, + GPIO_6, GPIO_7, GPIO_8, UART0_TXD, UART0_RXD, TOP_2G_CLK, + TOP_2G_DATA, WF0_2G_HB0, WF0_2G_HB1, WF0_2G_HB2, WF0_2G_HB3, + WF0_2G_HB4, WF0_2G_HB5, WF0_2G_HB6] bias-disable: true
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 327/473 watchdog: bd9576: Drop "always-running" property
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Vaittinen <[email protected]>
[ Upstream commit e3b3afd34d84efcbe4543deb966b1990f43584b8 ]
The always-running (from linux,wdt-gpio.yaml) is abused by the BD9576 watchdog driver. It's defined meaning is "the watchdog is always running and can not be stopped". The BD9576 watchdog driver has implemented it as "start watchdog when loading the module and prevent it from being stopped".
Furthermore, the implementation does not set the WDOG_HW_RUNNING when enabling the watchdog due to the "always-running" at module loading. This will end up resulting a watchdog timeout if the device is not opened.
The culprit was pointed out by Guenter, discussion can be found from
https://lore.kernel.org/lkml/[email protected]/
Drop the invalid "always-running" handling.
--- drivers/watchdog/bd9576_wdt.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/watchdog/bd9576_wdt.c +1 -11
@@ -29,7 +29,6 @@ struct bd9576_wdt_priv {struct gpio_desc *gpiod_en;struct device *dev;struct regmap *regmap; -bool always_running;struct watchdog_device wdd; };
@@ -62,10 +61,7 @@ static int bd9576_wdt_stop(struct watchdog_device *wdd) {struct bd9576_wdt_priv *priv =watchdog_get_drvdata (wdd); -if (!priv->always_running) -bd9576_wdt_disable (priv); -else -set_bit (WDOG_HW_RUNNING , &wdd->status); +bd9576_wdt_disable (priv);return 0 ; }
@@ -264,9 +260,6 @@ static int bd9576_wdt_probe(struct platform_device *pdev)if (ret)return ret; - priv->always_running =device_property_read_bool (dev->parent, -"always-running" ); -watchdog_set_drvdata (&priv->wdd, priv); priv->wdd.info = &bd957x_wdt_ident;
@@ -281,9 +274,6 @@ static int bd9576_wdt_probe(struct platform_device *pdev)watchdog_stop_on_reboot (&priv->wdd); -if (priv->always_running) -bd9576_wdt_start (&priv->wdd); -return devm_watchdog_register_device (dev, &priv->wdd); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 328/473 watchdog: sa1100: Fix PTR_ERR_OR_ZERO() vs NULL check in sa1100dog_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 413bf4e857fd79617524d5dcd35f463e9aa2dd41 ]
devm_ioremap() doesn't return error pointers, it returns NULL on error. Update the check accordingly.
--- drivers/watchdog/sa1100_wdt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/watchdog/sa1100_wdt.c +2 -3
@@ -191,9 +191,8 @@ static int sa1100dog_probe(struct platform_device *pdev)if (!res)return -ENXIO ; reg_base =devm_ioremap (&pdev->dev, res->start,resource_size (res)); - ret =PTR_ERR_OR_ZERO (reg_base); -if (ret) -return ret; +if (!reg_base) +return -ENOMEM ; clk =clk_get (NULL ,"OSTIMER0" );if (IS_ERR (clk)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 329/473 usb: gadget: u_audio: Fix race condition use of controls after free during gadget unbind.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wulff <[email protected]>
[ Upstream commit 1b739388aa3f8dfb63a9fca777e6dfa6912d0464 ]
Hang on to the control IDs instead of pointers since those are correctly handled with locks.
--- drivers/usb/gadget/function/u_audio.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/usb/gadget/function/u_audio.c +9 -10
@@ -57,13 +57,13 @@ struct uac_rtd_params {/* Volume/Mute controls and their state */ int fu_id;/* Feature Unit ID */ -struct snd_kcontrol *snd_kctl_volume; -struct snd_kcontrol *snd_kctl_mute; +struct snd_ctl_elem_id snd_kctl_volume_id; +struct snd_ctl_elem_id snd_kctl_mute_id;s16 volume_min, volume_max, volume_res;s16 volume;int mute; -struct snd_kcontrol *snd_kctl_rate;/* read-only current rate */ +struct snd_ctl_elem_id snd_kctl_rate_id;/* read-only current rate */ int srate;/* selected samplerate */ int active;/* playback/capture running */
@@ -494,14 +494,13 @@ static inline void free_ep_fback(struct uac_rtd_params *prm, struct usb_ep *ep)static void set_active (struct uac_rtd_params *prm,bool active) {// notifying through the Rate ctrl -struct snd_kcontrol *kctl = prm->snd_kctl_rate;unsigned long flags;spin_lock_irqsave (&prm->lock, flags);if (prm->active != active) { prm->active = active;snd_ctl_notify (prm->uac->card,SNDRV_CTL_EVENT_MASK_VALUE , - &kctl->id); + &prm->snd_kctl_rate_id); }spin_unlock_irqrestore (&prm->lock, flags); }
@@ -807,7 +806,7 @@ int u_audio_set_volume(struct g_audio *audio_dev, int playback, s16 val)if (change)snd_ctl_notify (uac->card,SNDRV_CTL_EVENT_MASK_VALUE , - &prm->snd_kctl_volume->id); + &prm->snd_kctl_volume_id);return 0 ; }
@@ -856,7 +855,7 @@ int u_audio_set_mute(struct g_audio *audio_dev, int playback, int val)if (change)snd_ctl_notify (uac->card,SNDRV_CTL_EVENT_MASK_VALUE , - &prm->snd_kctl_mute->id); + &prm->snd_kctl_mute_id);return 0 ; }
@@ -1331,7 +1330,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, err =snd_ctl_add (card, kctl);if (err <0 ) goto snd_fail; - prm->snd_kctl_mute = kctl; + prm->snd_kctl_mute_id = kctl->id; prm->mute =0 ; }
@@ -1359,7 +1358,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, err =snd_ctl_add (card, kctl);if (err <0 ) goto snd_fail; - prm->snd_kctl_volume = kctl; + prm->snd_kctl_volume_id = kctl->id; prm->volume = fu->volume_max; prm->volume_max = fu->volume_max; prm->volume_min = fu->volume_min;
@@ -1383,7 +1382,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, err =snd_ctl_add (card, kctl);if (err <0 ) goto snd_fail; - prm->snd_kctl_rate = kctl; + prm->snd_kctl_rate_id = kctl->id; }strscpy (card->driver, card_name,sizeof (card->driver));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 330/473 usb: gadget: u_audio: Clear uac pointer when freed.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wulff <[email protected]>
[ Upstream commit a2cf936ebef291ef7395172b9e2f624779fb6dc0 ]
This prevents use of a stale pointer if functions are called after g_cleanup that shouldn't be. This doesn't fix any races, but converts a possibly silent kernel memory corruption into an obvious NULL pointer dereference report.
--- drivers/usb/gadget/function/u_audio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/function/u_audio.c +2 -0
@@ -1419,6 +1419,8 @@ void g_audio_cleanup(struct g_audio *g_audio)return ; uac = g_audio->uac; + g_audio->uac =NULL ; + card = uac->card;if (card)snd_card_free_when_closed (card);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 331/473 stm class: Fix a double free in stm_register_device()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 3df463865ba42b8f88a590326f4c9ea17a1ce459 ]
The put_device(&stm->dev) call will trigger stm_device_release() which frees "stm" so the vfree(stm) on the next line is a double free.
--- drivers/hwtracing/stm/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/hwtracing/stm/core.c +6 -5
@@ -868,8 +868,11 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,return -ENOMEM ; stm->major =register_chrdev (0 , stm_data->name, &stm_fops); -if (stm->major <0 ) - goto err_free; +if (stm->major <0 ) { + err = stm->major; +vfree (stm); +return err; + }device_initialize (&stm->dev); stm->dev.devt =MKDEV (stm->major,0 );
@@ -913,10 +916,8 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data, err_device:unregister_chrdev (stm->major, stm_data->name); -/* matches device_initialize() above */ +/* calls stm_device_release() */ put_device (&stm->dev); -err_free: -vfree (stm);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 332/473 ppdev: Remove usage of the deprecated ida_simple_xx() API
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit d8407f71ebeaeb6f50bd89791837873e44609708 ]
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove().
This is less verbose.
Stable-dep-of: fbf740aeb86a ("ppdev: Add an error check in register_device")
--- drivers/char/ppdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/char/ppdev.c +3 -3
@@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) goto err; } - index =ida_simple_get (&ida_index,0 ,0 ,GFP_KERNEL ); + index =ida_alloc (&ida_index,GFP_KERNEL );memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ;
@@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp)if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ; -ida_simple_remove (&ida_index, index); +ida_free (&ida_index, index); goto err; }
@@ -750,7 +750,7 @@ static int pp_release(struct inode *inode, struct file *file)if (pp->pdev) {parport_unregister_device (pp->pdev); -ida_simple_remove (&ida_index, pp->index); +ida_free (&ida_index, pp->index); pp->pdev =NULL ;pr_debug (CHRDEV "%x: unregistered pardevice\n" , minor); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 333/473 ppdev: Add an error check in register_device
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huai-Yuan Liu <[email protected]>
[ Upstream commit fbf740aeb86a4fe82ad158d26d711f2f3be79b3e ]
In register_device, the return value of ida_simple_get is unchecked, in witch ida_simple_get will use an invalid index value.
To address this issue, index should be checked after ida_simple_get. When the index value is abnormal, a warning message should be printed, the port should be dropped, and the value should be recorded.
--- drivers/char/ppdev.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/char/ppdev.c +11 -4
@@ -296,28 +296,35 @@ static int register_device(int minor, struct pp_struct *pp)if (!port) {pr_warn ("%s: no associated port!\n" , name); rc = -ENXIO ; - goto err; + goto err_free_name; } index =ida_alloc (&ida_index,GFP_KERNEL ); +if (index <0 ) { +pr_warn ("%s: failed to get index!\n" , name); + rc = index; + goto err_put_port; + } +memset (&ppdev_cb,0 ,sizeof (ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags &PP_EXCL ) ?PARPORT_FLAG_EXCL :0 ; ppdev_cb.private = pp; pdev =parport_register_dev_model (port, name, &ppdev_cb, index); -parport_put_port (port);if (!pdev) {pr_warn ("%s: failed to register device!\n" , name); rc = -ENXIO ;ida_free (&ida_index, index); - goto err; + goto err_put_port; } pp->pdev = pdev; pp->index = index;dev_dbg (&pdev->dev,"registered pardevice\n" ); -err: +err_put_port: +parport_put_port (port); +err_free_name:kfree (name);return rc; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 334/473 perf bench internals inject-build-id: Fix trap divide when collecting just one DSO
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: He Zhe <[email protected]>
[ Upstream commit d9180e23fbfa3875424d3a6b28b71b072862a52a ]
'perf bench internals inject-build-id' suffers from the following error when only one DSO is collected.
# perf bench internals inject-build-id -v
Collected 1 DSOs
traps: internals-injec[2305] trap divide error
ip:557566ba6394 sp:7ffd4de97fe0 error:0 in perf[557566b2a000+23d000]
Build-id injection benchmark
Iteration #1
Floating point exceptionThis patch removes the unnecessary minus one from the divisor which also corrects the randomization range.
--- tools/perf/bench/inject-buildid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/bench/inject-buildid.c +1 -1
@@ -361,7 +361,7 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss)return -1 ;for (i =0 ; i < nr_mmaps; i++) { -int idx =rand () % (nr_dsos -1 ); +int idx =rand () % nr_dsos;struct bench_dso *dso = &dsos[idx];u64 timestamp =rand () %1000000 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 335/473 perf ui browser: Dont save pointer to stack memory
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 769e6a1e15bdbbaf2b0d2f37c24f2c53268bd21f ]
ui_browser__show() is capturing the input title that is stack allocated memory in hist_browser__run().
Avoid a use after return by strdup-ing the string.
Committer notes:
Further explanation from Ian Rogers:
My command line using tui is:
$ sudo bash -c 'rm /tmp/asan.log*; export
ASAN_OPTIONS="log_path=/tmp/asan.log"; /tmp/perf/perf mem record -a
sleep 1; /tmp/perf/perf mem report'
I then go to the perf annotate view and quit. This triggers the asan
error (from the log file):
```
==1254591==ERROR: AddressSanitizer: stack-use-after-return on address
0x7f2813331920 at pc 0x7f28180
65991 bp 0x7fff0a21c750 sp 0x7fff0a21bf10
READ of size 80 at 0x7f2813331920 thread T0
#0 0x7f2818065990 in __interceptor_strlen
../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:461
#1 0x7f2817698251 in SLsmg_write_wrapped_string
(/lib/x86_64-linux-gnu/libslang.so.2+0x98251)
#2 0x7f28176984b9 in SLsmg_write_nstring
(/lib/x86_64-linux-gnu/libslang.so.2+0x984b9)
#3 0x55c94045b365 in ui_browser__write_nstring ui/browser.c:60
#4 0x55c94045c558 in __ui_browser__show_title ui/browser.c:266
#5 0x55c94045c776 in ui_browser__show ui/browser.c:288
#6 0x55c94045c06d in ui_browser__handle_resize ui/browser.c:206
#7 0x55c94047979b in do_annotate ui/browsers/hists.c:2458
#8 0x55c94047fb17 in evsel__hists_browse ui/browsers/hists.c:3412
#9 0x55c940480a0c in perf_evsel_menu__run ui/browsers/hists.c:3527
#10 0x55c940481108 in __evlist__tui_browse_hists ui/browsers/hists.c:3613
#11 0x55c9404813f7 in evlist__tui_browse_hists ui/browsers/hists.c:3661
#12 0x55c93ffa253f in report__browse_hists tools/perf/builtin-report.c:671
#13 0x55c93ffa58ca in __cmd_report tools/perf/builtin-report.c:1141
#14 0x55c93ffaf159 in cmd_report tools/perf/builtin-report.c:1805
#15 0x55c94000c05c in report_events tools/perf/builtin-mem.c:374
#16 0x55c94000d96d in cmd_mem tools/perf/builtin-mem.c:516
#17 0x55c9400e44ee in run_builtin tools/perf/perf.c:350
#18 0x55c9400e4a5a in handle_internal_command tools/perf/perf.c:403
#19 0x55c9400e4e22 in run_argv tools/perf/perf.c:447
#20 0x55c9400e53ad in main tools/perf/perf.c:561
#21 0x7f28170456c9 in __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
#22 0x7f2817045784 in __libc_start_main_impl ../csu/libc-start.c:360
#23 0x55c93ff544c0 in _start (/tmp/perf/perf+0x19a4c0) (BuildId:
84899b0e8c7d3a3eaa67b2eb35e3d8b2f8cd4c93)Address 0x7f2813331920 is located in stack of thread T0 at offset 32 in frame
#0 0x55c94046e85e in hist_browser__run ui/browsers/hists.c:746
This frame has 1 object(s):
[32, 192) 'title' (line 747) <== Memory access at offset 32 is
inside this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
```hist_browser__run isn't on the stack so the asan error looks legit. There's no clean init/exit on struct ui_browser so I may be trading a use-after-return for a memory leak, but that seems look a good trade anyway.
--- tools/perf/ui/browser.c | 4 +++- tools/perf/ui/browser.h | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-)
tools/perf/ui/browser.c +3 -1
@@ -287,7 +287,8 @@ int ui_browser__show(struct ui_browser *browser, const char *title,mutex_lock (&ui__lock);__ui_browser__show_title (browser, title); - browser->title = title; +free (browser->title); + browser->title =strdup (title);zfree (&browser->helpline);va_start (ap, helpline);
@@ -304,6 +305,7 @@ void ui_browser__hide(struct ui_browser *browser)mutex_lock (&ui__lock);ui_helpline__pop ();zfree (&browser->helpline); +zfree (&browser->title);mutex_unlock (&ui__lock); }
tools/perf/ui/browser.h +1 -1
@@ -21,7 +21,7 @@ struct ui_browser {u8 extra_title_lines;int current_color;void *priv; -const char *title; +char *title;char *helpline;const char *no_samples_msg;void (*refresh_dimensions)(struct ui_browser *browser);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 336/473 extcon: max8997: select IRQ_DOMAIN instead of depending on it
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit b1781d0a1458070d40134e4f3412ec9d70099bec ]
IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set it directly thru "make *config", so drivers should select it instead of depending on it if they need it.
Relying on it being set for a dependency is risky.
Consistently using "select" or "depends on" can also help reduce Kconfig circular dependency issues.
Therefore, change EXTCON_MAX8997's use of "depends on" for IRQ_DOMAIN to "select".
--- drivers/extcon/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/extcon/Kconfig +2 -1
@@ -116,7 +116,8 @@ config EXTCON_MAX77843 config EXTCON_MAX8997 tristate "Maxim MAX8997 EXTCON Support" - depends on MFD_MAX8997 && IRQ_DOMAIN + depends on MFD_MAX8997 + select IRQ_DOMAIN help If you say yes here you get support for the MUIC device of Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 337/473 PCI/EDR: Align EDR_PORT_DPC_ENABLE_DSM with PCI Firmware r3.3
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuppuswamy Sathyanarayanan <[email protected]>
[ Upstream commit f24ba846133d0edec785ac6430d4daf6e9c93a09 ]
The "Downstream Port Containment related Enhancements" ECN of Jan 28, 2019 (document 12888 below), defined the EDR_PORT_DPC_ENABLE_DSM function with Revision ID 5 with Arg3 being an integer. But when the ECN was integrated into PCI Firmware r3.3, sec 4.6.12, it was defined as Revision ID 6 with Arg3 being a package containing an integer.
The implementation in acpi_enable_dpc() supplies a package as Arg3 (arg4 in the code), but it previously specified Revision ID 5. Align this with PCI Firmware r3.3 by using Revision ID 6.
If firmware implemented per the ECN, its Revision 5 function would receive a package as Arg3 when it expects an integer, so acpi_enable_dpc() would likely fail. If such firmware exists and lacks a Revision 6 function that expects a package, we may have to add support for Revision 5.
--- drivers/pci/pcie/edr.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/pci/pcie/edr.c +4 -9
@@ -32,10 +32,10 @@ static int acpi_enable_dpc(struct pci_dev *pdev)int status =0 ;/* -* Behavior when calling unsupported _DSM functions is undefined, -* so check whether EDR_PORT_DPC_ENABLE_DSM is supported. +* Per PCI Firmware r3.3, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is +* optional. Return success if it's not implemented. */ -if (!acpi_check_dsm (adev->handle, &pci_acpi_dsm_guid,5 , +if (!acpi_check_dsm (adev->handle, &pci_acpi_dsm_guid,6 ,1ULL <<EDR_PORT_DPC_ENABLE_DSM ))return 0 ;
@@ -46,12 +46,7 @@ static int acpi_enable_dpc(struct pci_dev *pdev) argv4.package.count =1 ; argv4.package.elements = &req; -/* -* Per Downstream Port Containment Related Enhancements ECN to PCI -* Firmware Specification r3.2, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is -* optional. Return success if it's not implemented. -*/ - obj =acpi_evaluate_dsm (adev->handle, &pci_acpi_dsm_guid,5 , + obj =acpi_evaluate_dsm (adev->handle, &pci_acpi_dsm_guid,6 ,EDR_PORT_DPC_ENABLE_DSM , &argv4);if (!obj)return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 338/473 PCI/EDR: Align EDR_PORT_LOCATE_DSM with PCI Firmware r3.3
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuppuswamy Sathyanarayanan <[email protected]>
[ Upstream commit e2e78a294a8a863898b781dbcf90e087eda3155d ]
The "Downstream Port Containment related Enhancements" ECN of Jan 28, 2019 (document 12888 below), defined the EDR_PORT_LOCATE_DSM function with Revision ID 5 with a return value encoding (Bits 2:0 = Function, Bits 7:3 = Device, Bits 15:8 = Bus). When the ECN was integrated into PCI Firmware r3.3, sec 4.6.13, Bit 31 was added to indicate success or failure.
Check Bit 31 for failure in acpi_dpc_port_get().
--- drivers/pci/pcie/edr.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/pci/pcie/edr.c +13 -2
@@ -80,8 +80,9 @@ static struct pci_dev *acpi_dpc_port_get(struct pci_dev *pdev)u16 port;/* -* Behavior when calling unsupported _DSM functions is undefined, -* so check whether EDR_PORT_DPC_ENABLE_DSM is supported. +* If EDR_PORT_LOCATE_DSM is not implemented under the target of +* EDR, the target is the port that experienced the containment +* event (PCI Firmware r3.3, sec 4.6.13). */ if (!acpi_check_dsm (adev->handle, &pci_acpi_dsm_guid,5 ,1ULL <<EDR_PORT_LOCATE_DSM ))
@@ -98,6 +99,16 @@ static struct pci_dev *acpi_dpc_port_get(struct pci_dev *pdev)return NULL ; } +/* +* Bit 31 represents the success/failure of the operation. If bit +* 31 is set, the operation failed. +*/ +if (obj->integer.value &BIT (31 )) { +ACPI_FREE (obj); +pci_err (pdev,"Locate Port _DSM failed\n" ); +return NULL ; + } +/* * Firmware returns DPC port BDF details in following format: * 15:8 = bus
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 339/473 perf ui browser: Avoid SEGV on title
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 90f01afb0dfafbc9b094bb61e61a4ac297d9d0d2 ]
If the title is NULL then it can lead to a SEGV.
--- tools/perf/ui/browser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/ui/browser.c +1 -1
@@ -203,7 +203,7 @@ void ui_browser__refresh_dimensions(struct ui_browser *browser)void ui_browser__handle_resize (struct ui_browser *browser) {ui__refresh_dimensions (false); -ui_browser__show (browser, browser->title, ui_helpline__current); +ui_browser__show (browser, browser->title ?:"" , ui_helpline__current);ui_browser__refresh (browser); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 340/473 perf report: Avoid SEGV in report__setup_sample_type()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 45b4f402a6b782352c4bafcff682bfb01da9ca05 ]
In some cases evsel->name is lazily initialized in evsel__name(). If not initialized passing NULL to strstr() leads to a SEGV.
--- tools/perf/builtin-report.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-report.c +1 -1
@@ -416,7 +416,7 @@ static int report__setup_sample_type(struct report *rep)* compatibility, set the bit if it's an old perf data file. */ evlist__for_each_entry (session->evlist, evsel) { -if (strstr (evsel->name,"arm_spe" ) && +if (strstr (evsel__name (evsel),"arm_spe" ) && !(sample_type &PERF_SAMPLE_DATA_SRC )) { evsel->core.attr.sample_type |=PERF_SAMPLE_DATA_SRC ; sample_type |=PERF_SAMPLE_DATA_SRC ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 341/473 f2fs: compress: fix to update i_compr_blocks correctly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 186e7d71534df4589405925caca5597af7626c12 ]
Previously, we account reserved blocks and compressed blocks into @compr_blocks, then, f2fs_i_compr_blocks_update(,compr_blocks) will update i_compr_blocks incorrectly, fix it.
Meanwhile, for the case all blocks in cluster were reserved, fix to update dn->ofs_in_node correctly.
--- fs/f2fs/file.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
fs/f2fs/file.c +14 -7
@@ -3588,7 +3588,8 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,while (count) {int compr_blocks =0 ; -blkcnt_t reserved; +blkcnt_t reserved =0 ; +blkcnt_t to_reserved;int ret;for (i =0 ; i < cluster_size; i++) {
@@ -3608,20 +3609,26 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,* fails in release_compress_blocks(), so NEW_ADDR * is a possible case. */ -if (blkaddr ==NEW_ADDR || -__is_valid_data_blkaddr (blkaddr)) { +if (blkaddr ==NEW_ADDR ) { + reserved++; +continue ; + } +if (__is_valid_data_blkaddr (blkaddr)) { compr_blocks++;continue ; } } - reserved = cluster_size - compr_blocks; + to_reserved = cluster_size - compr_blocks - reserved;/* for the case all blocks in cluster were reserved */ -if (reserved ==1 ) +if (to_reserved ==1 ) { + dn->ofs_in_node += cluster_size; goto next; + } - ret =inc_valid_block_count (sbi, dn->inode, &reserved, false); + ret =inc_valid_block_count (sbi, dn->inode, + &to_reserved, false);if (unlikely (ret))return ret;
@@ -3632,7 +3639,7 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,f2fs_i_compr_blocks_update (dn->inode, compr_blocks, true); - *reserved_blocks += reserved; + *reserved_blocks += to_reserved; next: count -= cluster_size; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 342/473 f2fs: compress: fix to cover {reserve,release}_compress_blocks() w/ cp_rwsem lock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 0a4ed2d97cb6d044196cc3e726b6699222b41019 ]
It needs to cover {reserve,release}_compress_blocks() w/ cp_rwsem lock to avoid racing with checkpoint, otherwise, filesystem metadata including blkaddr in dnode, inode fields and .total_valid_block_count may be corrupted after SPO case.
--- fs/f2fs/file.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/f2fs/file.c +10 -0
@@ -3515,9 +3515,12 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)struct dnode_of_data dn;pgoff_t end_offset, count; +f2fs_lock_op (sbi); +set_new_dnode (&dn, inode,NULL ,NULL ,0 ); ret =f2fs_get_dnode_of_data (&dn, page_idx,LOOKUP_NODE );if (ret) { +f2fs_unlock_op (sbi);if (ret == -ENOENT ) { page_idx =f2fs_get_next_page_offset (&dn, page_idx);
@@ -3535,6 +3538,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)f2fs_put_dnode (&dn); +f2fs_unlock_op (sbi); +if (ret <0 )break ;
@@ -3687,9 +3692,12 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)struct dnode_of_data dn;pgoff_t end_offset, count; +f2fs_lock_op (sbi); +set_new_dnode (&dn, inode,NULL ,NULL ,0 ); ret =f2fs_get_dnode_of_data (&dn, page_idx,LOOKUP_NODE );if (ret) { +f2fs_unlock_op (sbi);if (ret == -ENOENT ) { page_idx =f2fs_get_next_page_offset (&dn, page_idx);
@@ -3707,6 +3715,8 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)f2fs_put_dnode (&dn); +f2fs_unlock_op (sbi); +if (ret <0 )break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 343/473 f2fs: fix to release node block count in error path of f2fs_new_node_page()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 0fa4e57c1db263effd72d2149d4e21da0055c316 ]
It missed to call dec_valid_node_count() to release node block count in error path, fix it.
--- fs/f2fs/node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/node.c +1 -1
@@ -1307,6 +1307,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs) }if (unlikely (new_ni.blk_addr !=NULL_ADDR )) { err = -EFSCORRUPTED ; +dec_valid_node_count (sbi, dn->inode, !ofs);set_sbi_flag (sbi,SBI_NEED_FSCK );f2fs_handle_error (sbi,ERROR_INVALID_BLKADDR ); goto fail;
@@ -1333,7 +1334,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)if (ofs ==0 )inc_valid_inode_count (sbi);return page; - fail:clear_node_page_dirty (page);f2fs_put_page (page,1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 344/473 f2fs: compress: dont allow unaligned truncation on released compress inode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit 29ed2b5dd521ce7c5d8466cd70bf0cc9d07afeee ]
f2fs image may be corrupted after below testcase:
- mkfs.f2fs -O extra_attr,compression -f /dev/vdb
- mount /dev/vdb /mnt/f2fs
- touch /mnt/f2fs/file
- f2fs_io setflags compression /mnt/f2fs/file
- dd if=/dev/zero of=/mnt/f2fs/file bs=4k count=4
- f2fs_io release_cblocks /mnt/f2fs/file
- truncate -s 8192 /mnt/f2fs/file
- umount /mnt/f2fs
- fsck.f2fs /dev/vdb
[ASSERT] (fsck_chk_inode_blk:1256) --> ino: 0x5 has i_blocks: 0x00000002, but has 0x3 blocks
[FSCK] valid_block_count matching with CP [Fail] [0x4, 0x5]
[FSCK] other corrupted bugs [Fail]
The reason is: partial truncation assume compressed inode has reserved blocks, after partial truncation, valid block count may change w/o .i_blocks and .total_valid_block_count update, result in corruption.
This patch only allow cluster size aligned truncation on released compress inode for fixing.
--- fs/f2fs/file.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/f2fs/file.c +8 -3
@@ -940,9 +940,14 @@ int f2fs_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, ATTR_GID | ATTR_TIMES_SET))))return -EPERM ; -if ((attr->ia_valid &ATTR_SIZE ) && - !f2fs_is_compress_backend_ready (inode)) -return -EOPNOTSUPP ; +if ((attr->ia_valid &ATTR_SIZE )) { +if (!f2fs_is_compress_backend_ready (inode)) +return -EOPNOTSUPP ; +if (is_inode_flag_set (inode,FI_COMPRESS_RELEASED ) && + !IS_ALIGNED (attr->ia_size, +F2FS_BLK_TO_BYTES (F2FS_I (inode)->i_cluster_size))) +return -EINVAL ; + } err =setattr_prepare (mnt_userns, dentry, attr);if (err)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 345/473 serial: sh-sci: protect invalidating RXDMA on shutdown
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit aae20f6e34cd0cbd67a1d0e5877561c40109a81b ]
The to-be-fixed commit removed locking when invalidating the DMA RX descriptors on shutdown. It overlooked that there is still a rx_timer running which may still access the protected data. So, re-add the locking.
--- drivers/tty/serial/sh-sci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/tty/serial/sh-sci.c +5 -0
@@ -1244,9 +1244,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s)static void sci_dma_rx_release (struct sci_port *s) {struct dma_chan *chan = s->chan_rx_saved; +struct uart_port *port = &s->port; +unsigned long flags; +uart_port_lock_irqsave (port, &flags); s->chan_rx_saved =NULL ;sci_dma_rx_chan_invalidate (s); +uart_port_unlock_irqrestore (port, flags); +dmaengine_terminate_sync (chan);dma_free_coherent (chan->device->dev, s->buf_len_rx *2 , s->rx_buf[0 ],sg_dma_address (&s->sg_rx[0 ]));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 346/473 libsubcmd: Fix parse-options memory leak
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 230a7a71f92212e723fa435d4ca5922de33ec88a ]
If a usage string is built in parse_options_subcommand, also free it.
--- tools/lib/subcmd/parse-options.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/lib/subcmd/parse-options.c +5 -3
@@ -633,11 +633,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o const char *const subcommands[], const char *usagestr[], int flags) { struct parse_opt_ctx_t ctx; +char *buf =NULL ;/* build usage string if it's not provided */ if (subcommands && !usagestr[0 ]) { -char *buf =NULL ; -astrcatf (&buf,"%s %s [<options>] {" , subcmd_config.exec_name, argv[0 ]);for (int i =0 ; subcommands[i]; i++) {
@@ -679,7 +678,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *oastrcatf (&error_buf,"unknown switch `%c'" , *ctx.opt);usage_with_options (usagestr, options); } - +if (buf) { + usagestr[0 ] =NULL ; +free (buf); + }return parse_options_end (&ctx); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 347/473 perf daemon: Fix file leak in daemon_session__control
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samasth Norway Ananda <[email protected]>
[ Upstream commit 09541603462c399c7408d50295db99b4b8042eaa ]
The open() function returns -1 on error.
The 'control' and 'ack' file descriptors are both initialized with open() and further validated with 'if' statement.
'if (!control)' would evaluate to 'true' if returned value on error were '0' but it is actually '-1'.
--- tools/perf/builtin-daemon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/builtin-daemon.c +2 -2
@@ -523,7 +523,7 @@ static int daemon_session__control(struct daemon_session *session, session->base, SESSION_CONTROL); control =open (control_path,O_WRONLY |O_NONBLOCK ); -if (!control) +if (control <0 )return -1 ;if (do_ack) {
@@ -532,7 +532,7 @@ static int daemon_session__control(struct daemon_session *session, session->base, SESSION_ACK); ack =open (ack_path,O_RDONLY ,O_NONBLOCK ); -if (!ack) { +if (ack <0 ) {close (control);return -1 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 348/473 f2fs: fix to add missing iput() in gc_data_segment()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Yu <[email protected]>
[ Upstream commit a798ff17cd2dabe47d5d4ed3d509631793c36e19 ]
During gc_data_segment(), if inode state is abnormal, it missed to call iput(), fix it.
--- fs/f2fs/gc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
fs/f2fs/gc.c +7 -2
@@ -1566,10 +1566,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,int err; inode =f2fs_iget (sb, dni.ino); -if (IS_ERR (inode) ||is_bad_inode (inode) || -special_file (inode->i_mode)) +if (IS_ERR (inode))continue ; +if (is_bad_inode (inode) || +special_file (inode->i_mode)) { +iput (inode); +continue ; + } + err =f2fs_gc_pinned_control (inode, gc_type, segno);if (err == -EAGAIN ) {iput (inode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 349/473 perf stat: Dont display metric header for non-leader uncore events
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit 193a9e30207f54777ff42d0d8be8389edc522277 ]
On an Intel tigerlake laptop a metric like:
{
"BriefDescription": "Test",
"MetricExpr": "imc_free_running@data_read@ + imc_free_running@data_write@",
"MetricGroup": "Test",
"MetricName": "Test",
"ScaleUnit": "6.103515625e-5MiB"
},Will have 4 events:
uncore_imc_free_running_0/data_read/
uncore_imc_free_running_0/data_write/
uncore_imc_free_running_1/data_read/
uncore_imc_free_running_1/data_write/
If aggregration is disabled with metric-only 2 column headers are needed:
$ perf stat -M test --metric-only -A -a sleep 1
Performance counter stats for 'system wide':
MiB Test MiB Test
CPU0 1821.0 1820.5
But when not, the counts aggregated in the metric leader and only 1 column should be shown:
$ perf stat -M test --metric-only -a sleep 1 Performance counter stats for 'system wide':
MiB Test
5909.4
1.001258915 seconds time elapsedAchieve this by skipping events that aren't metric leaders when printing column headers and aggregation isn't disabled.
The bug is long standing, the fixes tag is set to a refactor as that is as far back as is reasonable to backport.
--- tools/perf/util/stat-display.c | 3 +++ 1 file changed, 3 insertions(+)
tools/perf/util/stat-display.c +3 -0
@@ -1162,6 +1162,9 @@ static void print_metric_headers(struct perf_stat_config *config,/* Print metrics headers only */ evlist__for_each_entry (evlist, counter) { +if (config->aggr_mode !=AGGR_NONE && counter->metric_leader != counter) +continue ; + os.evsel = counter;if (!first && config->json_output)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 350/473 LoongArch: Fix callchain parse error with kernel tracepoint events again
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
[ Upstream commit d6af2c76399f98444a5b4de96baf4b362d9f102b ]
With commit d3119bc985fb645 ("LoongArch: Fix callchain parse error with kernel tracepoint events"), perf can parse kernel callchain, but not complete and sometimes maybe error. The reason is LoongArch's unwinders (guess, prologue and orc) don't really need fp (i.e., regs[22]), and they use sp (i.e., regs[3]) as the frame address rather than the current stack pointer.
Fix that by removing the assignment of regs[22], and instead assign the __builtin_frame_address(0) to regs[3].
Without fix:
Children Self Command Shared Object Symbol
........ ........ ............. ................. ................
33.91% 33.91% swapper [kernel.vmlinux] [k] __schedule
|
|--33.04%--__schedule
|
--0.87%--__arch_cpu_idle
__scheduleWith this fix:
Children Self Command Shared Object Symbol
........ ........ ............. ................. ................
31.16% 31.16% swapper [kernel.vmlinux] [k] __schedule
|
|--20.63%--smpboot_entry
| cpu_startup_entry
| schedule_idle
| __schedule
|
--10.53%--start_kernel
cpu_startup_entry
schedule_idle
__schedule--- arch/loongarch/include/asm/perf_event.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/loongarch/include/asm/perf_event.h +1 -2
@@ -13,8 +13,7 @@#define perf_arch_fetch_caller_regs (regs, __ip) { \ (regs)->csr_era = (__ip); \ - (regs)->regs[3] = current_stack_pointer; \ - (regs)->regs[22] = (unsigned long) __builtin_frame_address(0); \ + (regs)->regs[3] = (unsigned long) __builtin_frame_address(0); \ }#endif /* __LOONGARCH_PERF_EVENT_H__ */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 351/473 s390/vdso: filter out mno-pic-data-is-text-relative cflag
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumanth Korikkar <[email protected]>
[ Upstream commit d15e4314abec83e4f910659437bc809b0889e3a5 ]
cmd_vdso_check checks if there are any dynamic relocations in vdso64.so.dbg. When kernel is compiled with -mno-pic-data-is-text-relative, R_390_RELATIVE relocs are generated and this results in kernel build error.
kpatch uses -mno-pic-data-is-text-relative option when building the kernel to prevent relative addressing between code and data. The flag avoids relocation error when klp text and data are too far apart
kpatch does not patch vdso code and hence the mno-pic-data-is-text-relative flag is not essential.
Stable-dep-of: 10f705253651 ("s390/vdso: Generate unwind information for C modules")
--- arch/s390/kernel/vdso32/Makefile | 1 + arch/s390/kernel/vdso64/Makefile | 1 + 2 files changed, 2 insertions(+)
arch/s390/kernel/vdso32/Makefile +1 -0
@@ -20,6 +20,7 @@ KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) KBUILD_AFLAGS_32 += -m31 -s KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) +KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \
arch/s390/kernel/vdso64/Makefile +1 -0
@@ -25,6 +25,7 @@ KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS)) KBUILD_AFLAGS_64 += -m64 -s KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) +KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin ldflags-y := -shared -soname=linux-vdso64.so.1 \ --hash-style=both --build-id=sha1 -T
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 352/473 s390/vdso64: filter out munaligned-symbols flag for vdso
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumanth Korikkar <[email protected]>
[ Upstream commit 8192a1b3807510d0ed5be1f8988c08f8d41cced9 ]
Gcc recently implemented an optimization [1] for loading symbols without explicit alignment, aligning with the IBM Z ELF ABI. This ABI mandates symbols to reside on a 2-byte boundary, enabling the use of the larl instruction. However, kernel linker scripts may still generate unaligned symbols. To address this, a new -munaligned-symbols option has been introduced [2] in recent gcc versions.
[1] https://gcc.gnu.org/pipermail/gcc-patches/2023-June/622872.html
[2] https://gcc.gnu.org/pipermail/gcc-patches/2023-August/625986.html
However, when -munaligned-symbols is used in vdso code, it leads to the following compilation error:.data.rel.ro.local' referenced in section .text' of arch/s390/kernel/vdso64/vdso64_generic.o: defined in discarded section `.data.rel.ro.local' of arch/s390/kernel/vdso64/vdso64_generic.o
vdso linker script discards .data section to make it lightweight. However, -munaligned-symbols in vdso object files references literal pool and accesses _vdso_data. Hence, compile vdso code without -munaligned-symbols. This means in the future, vdso code should deal with alignment of newly introduced unaligned linker symbols.
Stable-dep-of: 10f705253651 ("s390/vdso: Generate unwind information for C modules")
--- arch/s390/kernel/vdso64/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/s390/kernel/vdso64/Makefile +1 -0
@@ -26,6 +26,7 @@ KBUILD_AFLAGS_64 += -m64 -s KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) +KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin ldflags-y := -shared -soname=linux-vdso64.so.1 \ --hash-style=both --build-id=sha1 -T
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 353/473 s390/vdso: Generate unwind information for C modules
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Remus <[email protected]>
[ Upstream commit 10f70525365146046dddcc3d36bfaea2aee0376a ]
GDB fails to unwind vDSO functions with error message "PC not saved", for instance when stepping through gettimeofday().
Add -fasynchronous-unwind-tables to CFLAGS to generate .eh_frame DWARF unwind information for the vDSO C modules.
--- arch/s390/kernel/vdso32/Makefile | 3 ++- arch/s390/kernel/vdso64/Makefile | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
arch/s390/kernel/vdso32/Makefile +2 -1
@@ -21,7 +21,8 @@ KBUILD_AFLAGS_32 += -m31 -s KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) -KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin +KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32)) +KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \ --hash-style=both --build-id=sha1 -melf_s390 -T
arch/s390/kernel/vdso64/Makefile +2 -1
@@ -27,7 +27,8 @@ KBUILD_AFLAGS_64 += -m64 -s KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64)) -KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin +KBUILD_CFLAGS_64 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_64)) +KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin -fasynchronous-unwind-tables ldflags-y := -shared -soname=linux-vdso64.so.1 \ --hash-style=both --build-id=sha1 -T
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 354/473 s390/vdso: Use standard stack frame layout
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
[ Upstream commit 185445c7c137822ad856aae91a41e199370cb534 ]
By default user space is compiled with standard stack frame layout and not with the packed stack layout. The vdso code however inherited the -mpacked-stack compiler option from the kernel. Remove this option to make sure the vdso is compiled with standard stack frame layout.
This makes sure that the stack frame backchain location for vdso generated stack frames is the same like for calling code (if compiled with default options). This allows to manually walk stack frames without DWARF information, like the kernel is doing it e.g. with arch_stack_walk_user().
--- arch/s390/kernel/vdso32/Makefile | 1 + arch/s390/kernel/vdso64/Makefile | 1 + 2 files changed, 2 insertions(+)
arch/s390/kernel/vdso32/Makefile +1 -0
@@ -20,6 +20,7 @@ KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS)) KBUILD_AFLAGS_32 += -m31 -s KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS)) +KBUILD_CFLAGS_32 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS)) KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32)) KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables
arch/s390/kernel/vdso64/Makefile +1 -0
@@ -25,6 +25,7 @@ KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS)) KBUILD_AFLAGS_64 += -m64 -s KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS)) +KBUILD_CFLAGS_64 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64)) KBUILD_CFLAGS_64 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_64))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 355/473 s390/ipl: Fix incorrect initialization of len fields in nvme reipl block
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Egorenkov <[email protected]>
[ Upstream commit 9c922b73acaf39f867668d9cbe5dc69c23511f84 ]
Use correct symbolic constants IPL_BP_NVME_LEN and IPL_BP0_NVME_LEN to initialize nvme reipl block when 'scp_data' sysfs attribute is being updated. This bug had not been detected before because the corresponding fcp and nvme symbolic constants are equal.
--- arch/s390/kernel/ipl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/s390/kernel/ipl.c +2 -2
@@ -834,8 +834,8 @@ static ssize_t reipl_nvme_scpdata_write(struct file *filp, struct kobject *kobj, scpdata_len += padding; } - reipl_block_nvme->hdr.len =IPL_BP_FCP_LEN + scpdata_len; - reipl_block_nvme->nvme.len =IPL_BP0_FCP_LEN + scpdata_len; + reipl_block_nvme->hdr.len =IPL_BP_NVME_LEN + scpdata_len; + reipl_block_nvme->nvme.len =IPL_BP0_NVME_LEN + scpdata_len; reipl_block_nvme->nvme.scp_data_len = scpdata_len;return count;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 356/473 s390/ipl: Fix incorrect initialization of nvme dump block
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Egorenkov <[email protected]>
[ Upstream commit 7faacaeaf6ce12fae78751de5ad869d8f1e1cd7a ]
Initialize the correct fields of the nvme dump block.
This bug had not been detected before because first, the fcp and nvme fields of struct ipl_parameter_block are part of the same union and, therefore, overlap in memory and second, they are identical in structure and size.
--- arch/s390/kernel/ipl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/ipl.c +3 -3
@@ -1604,9 +1604,9 @@ static int __init dump_nvme_init(void) } dump_block_nvme->hdr.len =IPL_BP_NVME_LEN ; dump_block_nvme->hdr.version =IPL_PARM_BLOCK_VERSION ; - dump_block_nvme->fcp.len =IPL_BP0_NVME_LEN ; - dump_block_nvme->fcp.pbt =IPL_PBT_NVME ; - dump_block_nvme->fcp.opt =IPL_PB0_NVME_OPT_DUMP ; + dump_block_nvme->nvme.len =IPL_BP0_NVME_LEN ; + dump_block_nvme->nvme.pbt =IPL_PBT_NVME ; + dump_block_nvme->nvme.opt =IPL_PB0_NVME_OPT_DUMP ; dump_capabilities |=DUMP_TYPE_NVME ;return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 357/473 s390/boot: Remove alt_stfle_fac_list from decompressor
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sven Schnelle <[email protected]>
[ Upstream commit e7dec0b7926f3cd493c697c4c389df77e8e8a34c ]
It is nowhere used in the decompressor, therefore remove it.
--- arch/s390/boot/startup.c | 1 - arch/s390/kernel/setup.c | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-)
arch/s390/boot/startup.c +0 -1
@@ -30,7 +30,6 @@ int __bootdata(is_full_image) = 1;struct initrd_data __bootdata (initrd_data );u64 __bootdata_preserved (stfle_fac_list [16 ]); -u64 __bootdata_preserved (alt_stfle_fac_list [16 ]);struct oldmem_data __bootdata_preserved (oldmem_data );void error (char *x)
arch/s390/kernel/setup.c +1 -1
@@ -155,7 +155,7 @@ unsigned int __bootdata_preserved(zlib_dfltcc_support);EXPORT_SYMBOL (zlib_dfltcc_support);u64 __bootdata_preserved (stfle_fac_list [16 ]);EXPORT_SYMBOL (stfle_fac_list); -u64 __bootdata_preserved (alt_stfle_fac_list [16 ]); +u64 alt_stfle_fac_list[16 ];struct oldmem_data __bootdata_preserved (oldmem_data );unsigned long VMALLOC_START ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 358/473 Input: ims-pcu - fix printf string overflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit bf32bceedd0453c70d9d022e2e29f98e446d7161 ]
clang warns about a string overflow in this driver
drivers/input/misc/ims-pcu.c:1802:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation] drivers/input/misc/ims-pcu.c:1814:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
Make the buffer a little longer to ensure it always fits.
--- drivers/input/misc/ims-pcu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/input/misc/ims-pcu.c +2 -2
@@ -42,8 +42,8 @@ struct ims_pcu_backlight {#define IMS_PCU_PART_NUMBER_LEN 15#define IMS_PCU_SERIAL_NUMBER_LEN 8#define IMS_PCU_DOM_LEN 8 -#define IMS_PCU_FW_VERSION_LEN (9 + 1) -#define IMS_PCU_BL_VERSION_LEN (9 + 1) +#define IMS_PCU_FW_VERSION_LEN 16 +#define IMS_PCU_BL_VERSION_LEN 16#define IMS_PCU_BL_RESET_REASON_LEN (2 + 1)#define IMS_PCU_PCU_B_DEVICE_ID 5
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 359/473 Input: ioc3kbd - convert to platform remove callback returning void
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 150e792dee9ca8416f3d375e48f2f4d7f701fc6b ]
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove callback to the void returning variant.
Stable-dep-of: d40e9edcf3eb ("Input: ioc3kbd - add device table")
--- drivers/input/serio/ioc3kbd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/input/serio/ioc3kbd.c +2 -4
@@ -190,7 +190,7 @@ static int ioc3kbd_probe(struct platform_device *pdev)return 0 ; } -static int ioc3kbd_remove (struct platform_device *pdev) +static void ioc3kbd_remove (struct platform_device *pdev) {struct ioc3kbd_data *d =platform_get_drvdata (pdev);
@@ -198,13 +198,11 @@ static int ioc3kbd_remove(struct platform_device *pdev)serio_unregister_port (d->kbd);serio_unregister_port (d->aux); - -return 0 ; }static struct platform_driver ioc3kbd_driver = { .probe = ioc3kbd_probe, - .remove = ioc3kbd_remove, + .remove_new = ioc3kbd_remove, .driver = { .name ="ioc3-kbd" , },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 360/473 Input: ioc3kbd - add device table
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Karel Balej <[email protected]>
[ Upstream commit d40e9edcf3eb925c259df9f9dd7319a4fcbc675b ]
Without the device table the driver will not auto-load when compiled as a module.
--- drivers/input/serio/ioc3kbd.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/input/serio/ioc3kbd.c +7 -0
@@ -200,9 +200,16 @@ static void ioc3kbd_remove(struct platform_device *pdev)serio_unregister_port (d->aux); } +static const struct platform_device_id ioc3kbd_id_table[] = { + {"ioc3-kbd" , }, + { } +}; +MODULE_DEVICE_TABLE (platform, ioc3kbd_id_table); +static struct platform_driver ioc3kbd_driver = { .probe = ioc3kbd_probe, .remove_new = ioc3kbd_remove, + .id_table = ioc3kbd_id_table, .driver = { .name ="ioc3-kbd" , },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 361/473 mmc: sdhci_am654: Add tuning algorithm for delay chain
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit 6231d99dd4119312ad41abf9383e18fec66cbe4b ]
Currently the sdhci_am654 driver only supports one tuning algorithm which should be used only when DLL is enabled. The ITAPDLY is selected from the largest passing window and the buffer is viewed as a circular buffer.
The new algorithm should be used when the delay chain is enabled. The ITAPDLY is selected from the largest passing window and the buffer is not viewed as a circular buffer.
This implementation is based off of the following paper: [1].
Also add support for multiple failing windows.
[1] https://www.ti.com/lit/an/spract9/spract9.pdf
--- drivers/mmc/host/sdhci_am654.c | 112 +++++++++++++++++++++++++++------ 1 file changed, 92 insertions(+), 20 deletions(-)
drivers/mmc/host/sdhci_am654.c +92 -20
@@ -149,10 +149,17 @@ struct sdhci_am654_data {int strb_sel;u32 flags;u32 quirks; +bool dll_enable;#define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0) }; +struct window { +u8 start; +u8 end; +u8 length; +}; +struct sdhci_am654_driver_data {const struct sdhci_pltfm_data *pdata;u32 flags;
@@ -294,10 +301,13 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , mask, val); -if (timing >MMC_TIMING_UHS_SDR25 && clock >=CLOCK_TOO_SLOW_HZ ) +if (timing >MMC_TIMING_UHS_SDR25 && clock >=CLOCK_TOO_SLOW_HZ ) {sdhci_am654_setup_dll (host, clock); -else + sdhci_am654->dll_enable = true; + }else {sdhci_am654_setup_delay_chain (sdhci_am654, timing); + sdhci_am654->dll_enable = false; + }regmap_update_bits (sdhci_am654->base,PHY_CTRL5 ,CLKBUFSEL_MASK , sdhci_am654->clkbuf_sel);
@@ -415,39 +425,101 @@ static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)return 0 ; } -#define ITAP_MAX 32 +#define ITAPDLY_LENGTH 32 +#define ITAPDLY_LAST_INDEX (ITAPDLY_LENGTH - 1) + +static u32 sdhci_am654_calculate_itap (struct sdhci_host *host,struct window + *fail_window,u8 num_fails,bool circular_buffer) +{ +u8 itap =0 , start_fail =0 , end_fail =0 , pass_length =0 ; +u8 first_fail_start =0 , last_fail_end =0 ; +struct device *dev =mmc_dev (host->mmc); +struct window pass_window = {0 ,0 ,0 }; +int prev_fail_end =-1 ; +u8 i; + +if (!num_fails) +return ITAPDLY_LAST_INDEX >>1 ; + +if (fail_window->length ==ITAPDLY_LENGTH ) { +dev_err (dev,"No passing ITAPDLY, return 0\n" ); +return 0 ; + } + + first_fail_start = fail_window->start; + last_fail_end = fail_window[num_fails -1 ].end; + +for (i =0 ; i < num_fails; i++) { + start_fail = fail_window[i].start; + end_fail = fail_window[i].end; + pass_length = start_fail - (prev_fail_end +1 ); + +if (pass_length > pass_window.length) { + pass_window.start = prev_fail_end +1 ; + pass_window.length = pass_length; + } + prev_fail_end = end_fail; + } + +if (!circular_buffer) + pass_length =ITAPDLY_LAST_INDEX - last_fail_end; +else + pass_length =ITAPDLY_LAST_INDEX - last_fail_end + first_fail_start; + +if (pass_length > pass_window.length) { + pass_window.start = last_fail_end +1 ; + pass_window.length = pass_length; + } + +if (!circular_buffer) + itap = pass_window.start + (pass_window.length >>1 ); +else + itap = (pass_window.start + (pass_window.length >>1 )) %ITAPDLY_LENGTH ; + +return (itap >ITAPDLY_LAST_INDEX ) ?ITAPDLY_LAST_INDEX >>1 : itap; +} +static int sdhci_am654_platform_execute_tuning (struct sdhci_host *host,u32 opcode) {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct sdhci_am654_data *sdhci_am654 =sdhci_pltfm_priv (pltfm_host); -int cur_val, prev_val =1 , fail_len =0 , pass_window =0 , pass_len; -u32 itap; +struct window fail_window[ITAPDLY_LENGTH ]; +u8 curr_pass, itap; +u8 fail_index =0 ; +u8 prev_pass =1 ; + +memset (fail_window,0 ,sizeof (fail_window));/* Enable ITAPDLY */ regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPDLYENA_MASK ,1 <<ITAPDLYENA_SHIFT ); -for (itap =0 ; itap <ITAP_MAX ; itap++) { +for (itap =0 ; itap <ITAPDLY_LENGTH ; itap++) {sdhci_am654_write_itapdly (sdhci_am654, itap); - cur_val = !mmc_send_tuning (host->mmc, opcode,NULL ); -if (cur_val && !prev_val) - pass_window = itap; + curr_pass = !mmc_send_tuning (host->mmc, opcode,NULL ); -if (!cur_val) - fail_len++; +if (!curr_pass && prev_pass) + fail_window[fail_index].start = itap; - prev_val = cur_val; +if (!curr_pass) { + fail_window[fail_index].end = itap; + fail_window[fail_index].length++; + } + +if (curr_pass && !prev_pass) + fail_index++; + + prev_pass = curr_pass; } -/* -* Having determined the length of the failing window and start of -* the passing window calculate the length of the passing window and -* set the final value halfway through it considering the range as a -* circular buffer -*/ - pass_len =ITAP_MAX - fail_len; - itap = (pass_window + (pass_len >>1 )) %ITAP_MAX ; + +if (fail_window[fail_index].length !=0 ) + fail_index++; + + itap =sdhci_am654_calculate_itap (host, fail_window, fail_index, + sdhci_am654->dll_enable); +sdhci_am654_write_itapdly (sdhci_am654, itap);return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 362/473 mmc: sdhci_am654: Write ITAPDLY for DDR52 timing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit d465234493bb6ad1b9c10a0c9ef9881b8d85081a ]
For DDR52 timing, DLL is enabled but tuning is not carried out, therefore the ITAPDLY value in PHY CTRL 4 register is not correct. Fix this by writing ITAPDLY after enabling DLL.
--- drivers/mmc/host/sdhci_am654.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci_am654.c +1 -0
@@ -304,6 +304,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)if (timing >MMC_TIMING_UHS_SDR25 && clock >=CLOCK_TOO_SLOW_HZ ) {sdhci_am654_setup_dll (host, clock); sdhci_am654->dll_enable = true; +sdhci_am654_write_itapdly (sdhci_am654, sdhci_am654->itap_del_sel[timing]); }else {sdhci_am654_setup_delay_chain (sdhci_am654, timing); sdhci_am654->dll_enable = false;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 363/473 mmc: sdhci_am654: Drop lookup for deprecated ti,otap-del-sel
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vignesh Raghavendra <[email protected]>
[ Upstream commit 5cb2f9286a31f33dc732c57540838ad9339393ab ]
ti,otap-del-sel has been deprecated since v5.7 and there are no users of this property and no documentation in the DT bindings either. Drop the fallback code looking for this property, this makes sdhci_am654_get_otap_delay() much easier to read as all the TAP values can be handled via a single iterator loop.
Stable-dep-of: 387c1bf7dce0 ("mmc: sdhci_am654: Add OTAP/ITAP delay enable")
--- drivers/mmc/host/sdhci_am654.c | 37 ++++++---------------------------- 1 file changed, 6 insertions(+), 31 deletions(-)
drivers/mmc/host/sdhci_am654.c +6 -31
@@ -140,7 +140,6 @@ static const struct timing_data td[] = {struct sdhci_am654_data {struct regmap *base; -bool legacy_otapdly;int otap_del_sel[ARRAY_SIZE (td)];int itap_del_sel[ARRAY_SIZE (td)];int clkbuf_sel;
@@ -278,11 +277,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)sdhci_set_clock (host, clock);/* Setup DLL Output TAP delay */ -if (sdhci_am654->legacy_otapdly) - otap_del_sel = sdhci_am654->otap_del_sel[0 ]; -else - otap_del_sel = sdhci_am654->otap_del_sel[timing]; - + otap_del_sel = sdhci_am654->otap_del_sel[timing]; otap_del_ena = (timing >MMC_TIMING_UHS_SDR25 ) ?1 :0 ; mask =OTAPDLYENA_MASK |OTAPDLYSEL_MASK ;
@@ -324,10 +319,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,u32 mask, val;/* Setup DLL Output TAP delay */ -if (sdhci_am654->legacy_otapdly) - otap_del_sel = sdhci_am654->otap_del_sel[0 ]; -else - otap_del_sel = sdhci_am654->otap_del_sel[timing]; + otap_del_sel = sdhci_am654->otap_del_sel[timing]; mask =OTAPDLYENA_MASK |OTAPDLYSEL_MASK ; val = (0x1 << OTAPDLYENA_SHIFT) |
@@ -649,32 +641,15 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host,int i;int ret; - ret =device_property_read_u32 (dev, td[MMC_TIMING_LEGACY ].otap_binding, - &sdhci_am654->otap_del_sel[MMC_TIMING_LEGACY ]); -if (ret) { -/* -* ti,otap-del-sel-legacy is mandatory, look for old binding -* if not found. -*/ - ret =device_property_read_u32 (dev,"ti,otap-del-sel" , - &sdhci_am654->otap_del_sel[0 ]); -if (ret) { -dev_err (dev,"Couldn't find otap-del-sel\n" ); - -return ret; - } - -dev_info (dev,"Using legacy binding ti,otap-del-sel\n" ); - sdhci_am654->legacy_otapdly = true; - -return 0 ; - } -for (i =MMC_TIMING_LEGACY ; i <=MMC_TIMING_MMC_HS400 ; i++) { ret =device_property_read_u32 (dev, td[i].otap_binding, &sdhci_am654->otap_del_sel[i]);if (ret) { +if (i ==MMC_TIMING_LEGACY ) { +dev_err (dev,"Couldn't find mandatory ti,otap-del-sel-legacy\n" ); +return ret; + }dev_dbg (dev,"Couldn't find %s\n" , td[i].otap_binding);/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 364/473 mmc: sdhci_am654: Add OTAP/ITAP delay enable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit 387c1bf7dce0dfea02080c8bdb066b5209e92155 ]
Currently the OTAP/ITAP delay enable functionality is incorrect in the am654_set_clock function. The OTAP delay is not enabled when timing < SDR25 bus speed mode. The ITAP delay is not enabled for timings that do not carry out tuning.
Add this OTAP/ITAP delay functionality according to the datasheet
[1] OTAPDLYENA and ITAPDLYENA for MMC0.
[1] https://www.ti.com/lit/ds/symlink/am62p.pdf
--- drivers/mmc/host/sdhci_am654.c | 40 ++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-)
drivers/mmc/host/sdhci_am654.c +26 -14
@@ -142,6 +142,7 @@ struct sdhci_am654_data {struct regmap *base;int otap_del_sel[ARRAY_SIZE (td)];int itap_del_sel[ARRAY_SIZE (td)]; +u32 itap_del_ena[ARRAY_SIZE (td)];int clkbuf_sel;int trm_icp;int drv_strength;
@@ -238,11 +239,13 @@ static void sdhci_am654_setup_dll(struct sdhci_host *host, unsigned int clock) }static void sdhci_am654_write_itapdly (struct sdhci_am654_data *sdhci_am654, -u32 itapdly) +u32 itapdly,u32 enable) {/* Set ITAPCHGWIN before writing to ITAPDLY */ regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPCHGWIN_MASK ,1 <<ITAPCHGWIN_SHIFT ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPDLYENA_MASK , + enable <<ITAPDLYENA_SHIFT );regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPDLYSEL_MASK , itapdly <<ITAPDLYSEL_SHIFT );regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPCHGWIN_MASK ,0 );
@@ -259,8 +262,8 @@ static void sdhci_am654_setup_delay_chain(struct sdhci_am654_data *sdhci_am654, mask =SELDLYTXCLK_MASK |SELDLYRXCLK_MASK ;regmap_update_bits (sdhci_am654->base,PHY_CTRL5 , mask, val); -sdhci_am654_write_itapdly (sdhci_am654, - sdhci_am654->itap_del_sel[timing]); +sdhci_am654_write_itapdly (sdhci_am654, sdhci_am654->itap_del_sel[timing], + sdhci_am654->itap_del_ena[timing]); }static void sdhci_am654_set_clock (struct sdhci_host *host,unsigned int clock)
@@ -269,7 +272,6 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)struct sdhci_am654_data *sdhci_am654 =sdhci_pltfm_priv (pltfm_host);unsigned char timing = host->mmc->ios.timing;u32 otap_del_sel; -u32 otap_del_ena;u32 mask, val;regmap_update_bits (sdhci_am654->base,PHY_CTRL1 ,ENDLL_MASK ,0 );
@@ -278,10 +280,9 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)/* Setup DLL Output TAP delay */ otap_del_sel = sdhci_am654->otap_del_sel[timing]; - otap_del_ena = (timing >MMC_TIMING_UHS_SDR25 ) ?1 :0 ; mask =OTAPDLYENA_MASK |OTAPDLYSEL_MASK ; - val = (otap_del_ena <<OTAPDLYENA_SHIFT ) | + val = (0x1 <<OTAPDLYENA_SHIFT ) | (otap_del_sel <<OTAPDLYSEL_SHIFT );/* Write to STRBSEL for HS400 speed mode */
@@ -299,7 +300,8 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)if (timing >MMC_TIMING_UHS_SDR25 && clock >=CLOCK_TOO_SLOW_HZ ) {sdhci_am654_setup_dll (host, clock); sdhci_am654->dll_enable = true; -sdhci_am654_write_itapdly (sdhci_am654, sdhci_am654->itap_del_sel[timing]); +sdhci_am654_write_itapdly (sdhci_am654, sdhci_am654->itap_del_sel[timing], + sdhci_am654->itap_del_ena[timing]); }else {sdhci_am654_setup_delay_chain (sdhci_am654, timing); sdhci_am654->dll_enable = false;
@@ -316,6 +318,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,struct sdhci_am654_data *sdhci_am654 =sdhci_pltfm_priv (pltfm_host);unsigned char timing = host->mmc->ios.timing;u32 otap_del_sel; +u32 itap_del_ena;u32 mask, val;/* Setup DLL Output TAP delay */
@@ -324,6 +327,12 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host, mask =OTAPDLYENA_MASK |OTAPDLYSEL_MASK ; val = (0x1 <<OTAPDLYENA_SHIFT ) | (otap_del_sel <<OTAPDLYSEL_SHIFT ); + + itap_del_ena = sdhci_am654->itap_del_ena[timing]; + + mask |=ITAPDLYENA_MASK ; + val |= (itap_del_ena <<ITAPDLYENA_SHIFT ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , mask, val); regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
@@ -477,6 +486,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host, {struct sdhci_pltfm_host *pltfm_host =sdhci_priv (host);struct sdhci_am654_data *sdhci_am654 =sdhci_pltfm_priv (pltfm_host); +unsigned char timing = host->mmc->ios.timing;struct window fail_window[ITAPDLY_LENGTH ];u8 curr_pass, itap;u8 fail_index =0 ;
@@ -485,11 +495,10 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,memset (fail_window,0 ,sizeof (fail_window));/* Enable ITAPDLY */ -regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPDLYENA_MASK , -1 <<ITAPDLYENA_SHIFT ); + sdhci_am654->itap_del_ena[timing] =0x1 ;for (itap =0 ; itap <ITAPDLY_LENGTH ; itap++) { -sdhci_am654_write_itapdly (sdhci_am654, itap); +sdhci_am654_write_itapdly (sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]); curr_pass = !mmc_send_tuning (host->mmc, opcode,NULL );
@@ -513,7 +522,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host, itap =sdhci_am654_calculate_itap (host, fail_window, fail_index, sdhci_am654->dll_enable); -sdhci_am654_write_itapdly (sdhci_am654, itap); +sdhci_am654_write_itapdly (sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);return 0 ; }
@@ -662,9 +671,12 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host, host->mmc->caps2 &= ~td[i].capability; } -if (td[i].itap_binding) -device_property_read_u32 (dev, td[i].itap_binding, - &sdhci_am654->itap_del_sel[i]); +if (td[i].itap_binding) { + ret =device_property_read_u32 (dev, td[i].itap_binding, + &sdhci_am654->itap_del_sel[i]); +if (!ret) + sdhci_am654->itap_del_ena[i] =0x1 ; + } }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 365/473 mmc: sdhci_am654: Add ITAPDLYSEL in sdhci_j721e_4bit_set_clock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit 9dff65bb5e09903c27d9cff947dff4d22b6ea6a1 ]
Add ITAPDLYSEL to sdhci_j721e_4bit_set_clock function. This allows to set the correct ITAPDLY for timings that do not carry out tuning.
--- drivers/mmc/host/sdhci_am654.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci_am654.c +9 -3
@@ -319,6 +319,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,unsigned char timing = host->mmc->ios.timing;u32 otap_del_sel;u32 itap_del_ena; +u32 itap_del_sel;u32 mask, val;/* Setup DLL Output TAP delay */
@@ -328,13 +329,18 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host, val = (0x1 <<OTAPDLYENA_SHIFT ) | (otap_del_sel <<OTAPDLYSEL_SHIFT ); +/* Setup Input TAP delay */ itap_del_ena = sdhci_am654->itap_del_ena[timing]; + itap_del_sel = sdhci_am654->itap_del_sel[timing]; - mask |=ITAPDLYENA_MASK ; - val |= (itap_del_ena <<ITAPDLYENA_SHIFT ); + mask |=ITAPDLYENA_MASK |ITAPDLYSEL_MASK ; + val |= (itap_del_ena <<ITAPDLYENA_SHIFT ) | + (itap_del_sel <<ITAPDLYSEL_SHIFT ); +regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPCHGWIN_MASK , +1 <<ITAPCHGWIN_SHIFT );regmap_update_bits (sdhci_am654->base,PHY_CTRL4 , mask, val); - +regmap_update_bits (sdhci_am654->base,PHY_CTRL4 ,ITAPCHGWIN_MASK ,0 );regmap_update_bits (sdhci_am654->base,PHY_CTRL5 ,CLKBUFSEL_MASK , sdhci_am654->clkbuf_sel);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 366/473 mmc: sdhci_am654: Fix ITAPDLY for HS400 timing
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Judith Mendez <[email protected]>
[ Upstream commit d3182932bb070e7518411fd165e023f82afd7d25 ]
While STRB is currently used for DATA and CRC responses, the CMD responses from the device to the host still require ITAPDLY for HS400 timing.
Currently what is stored for HS400 is the ITAPDLY from High Speed mode which is incorrect. The ITAPDLY for HS400 speed mode should be the same as ITAPDLY as HS200 timing after tuning is executed. Add the functionality to save ITAPDLY from HS200 tuning and save as HS400 ITAPDLY.
--- drivers/mmc/host/sdhci_am654.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/mmc/host/sdhci_am654.c +9 -0
@@ -300,6 +300,12 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)if (timing >MMC_TIMING_UHS_SDR25 && clock >=CLOCK_TOO_SLOW_HZ ) {sdhci_am654_setup_dll (host, clock); sdhci_am654->dll_enable = true; + +if (timing ==MMC_TIMING_MMC_HS400 ) { + sdhci_am654->itap_del_ena[timing] =0x1 ; + sdhci_am654->itap_del_sel[timing] = sdhci_am654->itap_del_sel[timing -1 ]; + } +sdhci_am654_write_itapdly (sdhci_am654, sdhci_am654->itap_del_sel[timing], sdhci_am654->itap_del_ena[timing]); }else {
@@ -530,6 +536,9 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,sdhci_am654_write_itapdly (sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]); +/* Save ITAPDLY */ + sdhci_am654->itap_del_sel[timing] = itap; +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 367/473 Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fenglin Wu <[email protected]>
[ Upstream commit 48c0687a322d54ac7e7a685c0b6db78d78f593af ]
The output voltage is inclusive hence the max level calculation is off-by-one-step. Correct it.
iWhile we are at it also add a define for the step size instead of using the magic value.
--- drivers/input/misc/pm8xxx-vibrator.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/input/misc/pm8xxx-vibrator.c +4 -3
@@ -14,7 +14,8 @@#define VIB_MAX_LEVEL_mV (3100)#define VIB_MIN_LEVEL_mV (1200) -#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV) +#define VIB_PER_STEP_mV (100) +#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV + VIB_PER_STEP_mV)#define MAX_FF_SPEED 0xff
@@ -118,10 +119,10 @@ static void pm8xxx_work_handler(struct work_struct *work) vib->active = true; vib->level = ((VIB_MAX_LEVELS * vib->speed) /MAX_FF_SPEED ) + VIB_MIN_LEVEL_mV; - vib->level /=100 ; + vib->level /= VIB_PER_STEP_mV; }else { vib->active = false; - vib->level = VIB_MIN_LEVEL_mV /100 ; + vib->level = VIB_MIN_LEVEL_mV / VIB_PER_STEP_mV; }pm8xxx_vib_set (vib, vib->active);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 368/473 drm/msm/dsi: Print dual-DSI-adjusted pclk instead of original mode pclk
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marijn Suijten <[email protected]>
[ Upstream commit f12e0e12524a34bf145f7b80122e653ffe3d130a ]
When dual-DSI (bonded DSI) was added in commit ed9976a09b48 ("drm/msm/dsi: adjust dsi timing for dual dsi mode") some DBG() prints were not updated, leading to print the original mode->clock rather than the adjusted (typically the mode clock divided by two, though more recently also adjusted for DSC compression) msm_host->pixel_clk_rate which is passed to clk_set_rate() just below. Fix that by printing the actual pixel_clk_rate that is being set.
Patchwork: https://patchwork.freedesktop.org/patch/589896/
--- drivers/gpu/drm/msm/dsi/dsi_host.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/dsi/dsi_host.c +5 -5
@@ -402,8 +402,8 @@ int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)unsigned long byte_intf_rate;int ret; -DBG ("Set clk rates: pclk=%d, byteclk=%lu" , - msm_host->mode->clock, msm_host->byte_clk_rate); +DBG ("Set clk rates: pclk=%lu, byteclk=%lu" , + msm_host->pixel_clk_rate, msm_host->byte_clk_rate); ret =dev_pm_opp_set_rate (&msm_host->pdev->dev, msm_host->byte_clk_rate);
@@ -482,9 +482,9 @@ int dsi_link_clk_set_rate_v2(struct msm_dsi_host *msm_host) {int ret; -DBG ("Set clk rates: pclk=%d, byteclk=%lu, esc_clk=%lu, dsi_src_clk=%lu" , - msm_host->mode->clock, msm_host->byte_clk_rate, - msm_host->esc_clk_rate, msm_host->src_clk_rate); +DBG ("Set clk rates: pclk=%lu, byteclk=%lu, esc_clk=%lu, dsi_src_clk=%lu" , + msm_host->pixel_clk_rate, msm_host->byte_clk_rate, + msm_host->esc_clk_rate, msm_host->src_clk_rate); ret =clk_set_rate (msm_host->byte_clk, msm_host->byte_clk_rate);if (ret) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 369/473 drm/msm/dpu: Always flush the slave INTF on the CTL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marijn Suijten <[email protected]>
[ Upstream commit 2b938c3ab0a69ec6ea587bbf6fc2aec3db4a8736 ]
As we can clearly see in a downstream kernel [1], flushing the slave INTF is skipped /only if/ the PPSPLIT topology is active.
However, when DPU was originally submitted to mainline PPSPLIT was no longer part of it (seems to have been ripped out before submission), but this clause was incorrectly ported from the original SDE driver. Given that there is no support for PPSPLIT (currently), flushing the slave INTF should /never/ be skipped (as the if (ppsplit && !master) goto skip; clause downstream never becomes true).
Patchwork: https://patchwork.freedesktop.org/patch/589901/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 3 --- 1 file changed, 3 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c +0 -3
@@ -439,9 +439,6 @@ static void dpu_encoder_phys_cmd_enable_helper(_dpu_encoder_phys_cmd_pingpong_config (phys_enc); -if (!dpu_encoder_phys_cmd_is_master (phys_enc)) -return ; - ctl = phys_enc->hw_ctl; ctl->ops.update_pending_flush_intf (ctl, phys_enc->intf_idx); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 370/473 drm/mediatek: dp: Move PHY registration to new function
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 18ccc237cf646f93e25b802e5cca0788f4f48b39 ]
In preparation for adding support for eDP, move the PHY registration code to a new mtk_dp_register_phy() function for better readability.
This commit brings no functional changes.
Stable-dep-of: 8431fff9e0f3 ("drm/mediatek: dp: Fix mtk_dp_aux_transfer return value")
--- drivers/gpu/drm/mediatek/mtk_dp.c | 43 +++++++++++++++++++------------ 1 file changed, 26 insertions(+), 17 deletions(-)
drivers/gpu/drm/mediatek/mtk_dp.c +26 -17
@@ -2490,6 +2490,29 @@ static int mtk_dp_register_audio_driver(struct device *dev)return PTR_ERR_OR_ZERO (mtk_dp->audio_pdev); } +static int mtk_dp_register_phy (struct mtk_dp *mtk_dp) +{ +struct device *dev = mtk_dp->dev; + + mtk_dp->phy_dev =platform_device_register_data (dev,"mediatek-dp-phy" , +PLATFORM_DEVID_AUTO , + &mtk_dp->regs, +sizeof (struct regmap *)); +if (IS_ERR (mtk_dp->phy_dev)) +return dev_err_probe (dev,PTR_ERR (mtk_dp->phy_dev), +"Failed to create device mediatek-dp-phy\n" ); + +mtk_dp_get_calibration_data (mtk_dp); + + mtk_dp->phy =devm_phy_get (&mtk_dp->phy_dev->dev,"dp" ); +if (IS_ERR (mtk_dp->phy)) { +platform_device_unregister (mtk_dp->phy_dev); +return dev_err_probe (dev,PTR_ERR (mtk_dp->phy),"Failed to get phy\n" ); + } + +return 0 ; +} +static int mtk_dp_probe (struct platform_device *pdev) {struct mtk_dp *mtk_dp;
@@ -2547,23 +2570,9 @@ static int mtk_dp_probe(struct platform_device *pdev) } } - mtk_dp->phy_dev =platform_device_register_data (dev,"mediatek-dp-phy" , -PLATFORM_DEVID_AUTO , - &mtk_dp->regs, -sizeof (struct regmap *)); -if (IS_ERR (mtk_dp->phy_dev)) -return dev_err_probe (dev,PTR_ERR (mtk_dp->phy_dev), -"Failed to create device mediatek-dp-phy\n" ); - -mtk_dp_get_calibration_data (mtk_dp); - - mtk_dp->phy =devm_phy_get (&mtk_dp->phy_dev->dev,"dp" ); - -if (IS_ERR (mtk_dp->phy)) { -platform_device_unregister (mtk_dp->phy_dev); -return dev_err_probe (dev,PTR_ERR (mtk_dp->phy), -"Failed to get phy\n" ); - } + ret =mtk_dp_register_phy (mtk_dp); +if (ret) +return ret; mtk_dp->bridge.funcs = &mtk_dp_bridge_funcs; mtk_dp->bridge.of_node = dev->of_node;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 371/473 drm/mediatek: dp: Add support for embedded DisplayPort aux-bus
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit caf2ae486742f6a93ca676bbebdfacfd34e4966d ]
For the eDP case we can support using aux-bus on MediaTek DP: this gives us the possibility to declare our panel as generic "panel-edp" which will automatically configure the timings and available modes via the EDID that we read from it.
To do this, move the panel parsing at the end of the probe function so that the hardware is initialized beforehand and also initialize the DPTX AUX block and power both on as, when we populate the aux-bus, the panel driver will trigger an EDID read to perform panel detection.
Last but not least, since now the AUX transfers can happen in the separated aux-bus, it was necessary to add an exclusion for the cable_plugged_in check in mtk_dp_aux_transfer() and the easiest way to do this is to simply ignore checking that when the bridge type is eDP.
Stable-dep-of: 8431fff9e0f3 ("drm/mediatek: dp: Fix mtk_dp_aux_transfer return value")
--- drivers/gpu/drm/mediatek/Kconfig | 1 + drivers/gpu/drm/mediatek/mtk_dp.c | 92 ++++++++++++++++++++++++++----- 2 files changed, 79 insertions(+), 14 deletions(-)
drivers/gpu/drm/mediatek/Kconfig +1 -0
@@ -27,6 +27,7 @@ config DRM_MEDIATEK_DP select PHY_MTK_DP select DRM_DISPLAY_HELPER select DRM_DISPLAY_DP_HELPER + select DRM_DP_AUX_BUS help DRM/KMS Display Port driver for MediaTek SoCs.
drivers/gpu/drm/mediatek/mtk_dp.c +78 -14
147 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 372/473 drm/mediatek: dp: Fix mtk_dp_aux_transfer return value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wojciech Macek <[email protected]>
[ Upstream commit 8431fff9e0f3fc1c5844cf99a73b49b63ceed481 ]
In case there is no DP device attached to the port the transfer function should return IO error, similar to what other drivers do.
In case EAGAIN is returned then any read from /dev/drm_dp_aux device ends up in an infinite loop as the upper layers constantly repeats the transfer request.
--- drivers/gpu/drm/mediatek/mtk_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_dp.c +1 -1
@@ -2058,7 +2058,7 @@ static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux,if (mtk_dp->bridge.type != DRM_MODE_CONNECTOR_eDP && !mtk_dp->train_info.cable_plugged_in) { - ret = -EAGAIN ; + ret = -EIO ; goto err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 373/473 um: Fix return value in ubd_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit 31a5990ed253a66712d7ddc29c92d297a991fdf2 ]
When kmalloc_array() fails to allocate memory, the ubd_init() should return -ENOMEM instead of -1. So, fix it.
--- arch/um/drivers/ubd_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/ubd_kern.c +2 -2
@@ -1099,7 +1099,7 @@ static int __init ubd_init(void)if (irq_req_buffer ==NULL ) {printk (KERN_ERR "Failed to initialize ubd buffering\n" ); -return -1 ; +return -ENOMEM ; } io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE, sizeof(struct io_thread_req *),
@@ -1110,7 +1110,7 @@ static int __init ubd_init(void)if (io_req_buffer ==NULL ) {printk (KERN_ERR "Failed to initialize ubd buffering\n" ); -return -1 ; +return -ENOMEM ; }platform_driver_register (&ubd_driver);mutex_lock (&ubd_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 374/473 um: Add winch to winch_handlers before registering winch IRQ
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roberto Sassu <[email protected]>
[ Upstream commit a0fbbd36c156b9f7b2276871d499c9943dfe5101 ]
Registering a winch IRQ is racy, an interrupt may occur before the winch is added to the winch_handlers list.
If that happens, register_winch_irq() adds to that list a winch that is scheduled to be (or has already been) freed, causing a panic later in winch_cleanup().
Avoid the race by adding the winch to the winch_handlers list before registering the IRQ, and rolling back if um_request_irq() fails.
--- arch/um/drivers/line.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
arch/um/drivers/line.c +8 -6
@@ -673,24 +673,26 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_port *port, goto cleanup; } - *winch = ((struct winch ) { .list =LIST_HEAD_INIT (winch->list), - .fd = fd, + *winch = ((struct winch ) { .fd = fd, .tty_fd = tty_fd, .pid = pid, .port = port, .stack = stack }); +spin_lock (&winch_handler_lock); +list_add (&winch->list, &winch_handlers); +spin_unlock (&winch_handler_lock); +if (um_request_irq (WINCH_IRQ , fd,IRQ_READ , winch_interrupt,IRQF_SHARED ,"winch" , winch) <0 ) {printk (KERN_ERR "register_winch_irq - failed to register " "IRQ\n" ); +spin_lock (&winch_handler_lock); +list_del (&winch->list); +spin_unlock (&winch_handler_lock); goto out_free; } -spin_lock (&winch_handler_lock); -list_add (&winch->list, &winch_handlers); -spin_unlock (&winch_handler_lock); -return ; out_free:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 375/473 um: vector: fix bpfflash parameter evaluation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
[ Upstream commit 584ed2f76ff5fe360d87a04d17b6520c7999e06b ]
With W=1 the build complains about a pointer compared to zero, clearly the result should've been compared.
--- arch/um/drivers/vector_kern.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/um/drivers/vector_kern.c +1 -1
@@ -141,7 +141,7 @@ static bool get_bpf_flash(struct arglist *def)if (allow !=NULL ) {if (kstrtoul (allow,10 , &result) ==0 ) -return (allow >0 ); +return result >0 ; }return false; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 376/473 fs/ntfs3: Use 64 bit variable to avoid 32 bit overflow
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit e931f6b630ffb22d66caab202a52aa8cbb10c649 ]
For example, in the expression:
vbo = 2 * vbo + skip
--- fs/ntfs3/fslog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/ntfs3/fslog.c +2 -1
@@ -1181,7 +1181,8 @@ static int read_log_page(struct ntfs_log *log, u32 vbo,static int log_read_rst (struct ntfs_log *log,u32 l_size,bool first,struct restart_info *info) { -u32 skip, vbo; +u32 skip; +u64 vbo;struct RESTART_HDR *r_page =NULL ;/* Determine which restart area we are looking for. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 377/473 fs/ntfs3: Use variable length array instead of fixed size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Komarov <[email protected]>
[ Upstream commit 1997cdc3e727526aa5d84b32f7cbb3f56459b7ef ]
Should fix smatch warning:
ntfs_set_label() error: __builtin_memcpy() 'uni->name' too small (20 vs 256)
--- fs/ntfs3/ntfs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/ntfs.h +1 -1
@@ -59,7 +59,7 @@ struct GUID {struct cpu_str {u8 len;u8 unused; -u16 name[10 ]; +u16 name[]; };struct le_str {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 378/473 drm/bridge: tc358775: fix support for jeida-18 and jeida-24
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Walle <[email protected]>
[ Upstream commit 30ea09a182cb37c4921b9d477ed18107befe6d78 ]
The bridge always uses 24bpp internally. Therefore, for jeida-18 mapping we need to discard the lowest two bits for each channel and thus starting with LV_[RGB]2. jeida-24 has the same mapping but uses four lanes instead of three, with the forth pair transmitting the lowest two bits of each channel. Thus, the mapping between jeida-18 and jeida-24 is actually the same, except that one channel is turned off (by selecting the RGB666 format in VPCTRL).
While at it, remove the bogus comment about the hardware default because the default is overwritten in any case.
Tested with a jeida-18 display (Evervision VGG644804).
--- drivers/gpu/drm/bridge/tc358775.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +9 -12
@@ -455,10 +455,6 @@ static void tc_bridge_enable(struct drm_bridge *bridge)dev_dbg (tc->dev,"bus_formats %04x bpc %d\n" , connector->display_info.bus_formats[0 ], tc->bpc); -/* -* Default hardware register settings of tc358775 configured -* with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format -*/ if (connector->display_info.bus_formats[0 ] ==MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ) {/* VESA-24 */
@@ -469,14 +465,15 @@ static void tc_bridge_enable(struct drm_bridge *bridge)d2l_write (tc->i2c,LV_MX1619 ,LV_MX (LVI_B6 ,LVI_B7 ,LVI_B1 ,LVI_B2 ));d2l_write (tc->i2c,LV_MX2023 ,LV_MX (LVI_B3 ,LVI_B4 ,LVI_B5 ,LVI_L0 ));d2l_write (tc->i2c,LV_MX2427 ,LV_MX (LVI_HS ,LVI_VS ,LVI_DE ,LVI_R6 )); - }else {/* MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - JEIDA-18 */ -d2l_write (tc->i2c,LV_MX0003 ,LV_MX (LVI_R0 ,LVI_R1 ,LVI_R2 ,LVI_R3 )); -d2l_write (tc->i2c,LV_MX0407 ,LV_MX (LVI_R4 ,LVI_L0 ,LVI_R5 ,LVI_G0 )); -d2l_write (tc->i2c,LV_MX0811 ,LV_MX (LVI_G1 ,LVI_G2 ,LVI_L0 ,LVI_L0 )); -d2l_write (tc->i2c,LV_MX1215 ,LV_MX (LVI_G3 ,LVI_G4 ,LVI_G5 ,LVI_B0 )); -d2l_write (tc->i2c,LV_MX1619 ,LV_MX (LVI_L0 ,LVI_L0 ,LVI_B1 ,LVI_B2 )); -d2l_write (tc->i2c,LV_MX2023 ,LV_MX (LVI_B3 ,LVI_B4 ,LVI_B5 ,LVI_L0 )); -d2l_write (tc->i2c,LV_MX2427 ,LV_MX (LVI_HS ,LVI_VS ,LVI_DE ,LVI_L0 )); + }else { +/* JEIDA-18 and JEIDA-24 */ +d2l_write (tc->i2c,LV_MX0003 ,LV_MX (LVI_R2 ,LVI_R3 ,LVI_R4 ,LVI_R5 )); +d2l_write (tc->i2c,LV_MX0407 ,LV_MX (LVI_R6 ,LVI_R1 ,LVI_R7 ,LVI_G2 )); +d2l_write (tc->i2c,LV_MX0811 ,LV_MX (LVI_G3 ,LVI_G4 ,LVI_G0 ,LVI_G1 )); +d2l_write (tc->i2c,LV_MX1215 ,LV_MX (LVI_G5 ,LVI_G6 ,LVI_G7 ,LVI_B2 )); +d2l_write (tc->i2c,LV_MX1619 ,LV_MX (LVI_B0 ,LVI_B1 ,LVI_B3 ,LVI_B4 )); +d2l_write (tc->i2c,LV_MX2023 ,LV_MX (LVI_B5 ,LVI_B6 ,LVI_B7 ,LVI_L0 )); +d2l_write (tc->i2c,LV_MX2427 ,LV_MX (LVI_HS ,LVI_VS ,LVI_DE ,LVI_R0 )); }d2l_write (tc->i2c,VFUEN ,VFUEN_EN );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 379/473 media: stk1160: fix bounds checking in stk1160_copy_video()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit faa4364bef2ec0060de381ff028d1d836600a381 ]
The subtract in this condition is reversed. The ->length is the length of the buffer. The ->bytesused is how many bytes we have copied thus far. When the condition is reversed that means the result of the subtraction is always negative but since it's unsigned then the result is a very high positive value. That means the overflow check is never true.
Additionally, the ->bytesused doesn't actually work for this purpose because we're not writing to "buf->mem + buf->bytesused". Instead, the math to calculate the destination where we are writing is a bit involved. You calculate the number of full lines already written, multiply by two, skip a line if necessary so that we start on an odd numbered line, and add the offset into the line.
To fix this buffer overflow, just take the actual destination where we are writing, if the offset is already out of bounds print an error and return. Otherwise, write up to buf->length bytes.
--- drivers/media/usb/stk1160/stk1160-video.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-)
drivers/media/usb/stk1160/stk1160-video.c +15 -5
@@ -99,7 +99,7 @@ void stk1160_buffer_done(struct stk1160 *dev)static inline void stk1160_copy_video (struct stk1160 *dev,u8 *src,int len) { -int linesdone, lineoff, lencopy; +int linesdone, lineoff, lencopy, offset;int bytesperline = dev->width *2 ;struct stk1160_buffer *buf = dev->isoc_ctl.buf;u8 *dst = buf->mem;
@@ -139,8 +139,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)* Check if we have enough space left in the buffer. * In that case, we force loop exit after copy. */ -if (lencopy > buf->bytesused - buf->length) { - lencopy = buf->bytesused - buf->length; + offset = dst - (u8 *)buf->mem; +if (offset > buf->length) { +dev_warn_ratelimited (dev->dev,"out of bounds offset\n" ); +return ; + } +if (lencopy > buf->length - offset) { + lencopy = buf->length - offset; remain = lencopy; }
@@ -182,8 +187,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)* Check if we have enough space left in the buffer. * In that case, we force loop exit after copy. */ -if (lencopy > buf->bytesused - buf->length) { - lencopy = buf->bytesused - buf->length; + offset = dst - (u8 *)buf->mem; +if (offset > buf->length) { +dev_warn_ratelimited (dev->dev,"offset out of bounds\n" ); +return ; + } +if (lencopy > buf->length - offset) { + lencopy = buf->length - offset; remain = lencopy; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 380/473 scsi: qla2xxx: Replace all non-returning strlcpy() with strscpy()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Azeem Shaikh <[email protected]>
[ Upstream commit 37f1663c91934f664fb850306708094a324c227c ]
strlcpy() reads the entire source buffer first. This read may exceed the destination size limit. This is both inefficient and can lead to linear read overflows if a source string is not NUL-terminated [1]. In an effort to remove strlcpy() completely [2], replace strlcpy() here with strscpy(). No return values were used, so direct replacement is safe.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
[2] https://github.com/KSPP/linux/issues/89
Stable-dep-of: c3408c4ae041 ("scsi: qla2xxx: Avoid possible run-time warning with long model_num")
--- drivers/scsi/qla2xxx/qla_init.c | 8 ++++---- drivers/scsi/qla2xxx/qla_mr.c | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +4 -4
@@ -5144,7 +5144,7 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,if (use_tbl && ha->pdev->subsystem_vendor ==PCI_VENDOR_ID_QLOGIC && index <QLA_MODEL_NAMES ) -strlcpy (ha->model_desc, +strscpy (ha->model_desc, qla2x00_model_name[index *2 +1 ],sizeof (ha->model_desc)); }else {
@@ -5152,14 +5152,14 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len,if (use_tbl && ha->pdev->subsystem_vendor ==PCI_VENDOR_ID_QLOGIC && index <QLA_MODEL_NAMES ) { -strlcpy (ha->model_number, +strscpy (ha->model_number, qla2x00_model_name[index *2 ],sizeof (ha->model_number)); -strlcpy (ha->model_desc, +strscpy (ha->model_desc, qla2x00_model_name[index *2 +1 ],sizeof (ha->model_desc)); }else { -strlcpy (ha->model_number, def, +strscpy (ha->model_number, def,sizeof (ha->model_number)); } }
drivers/scsi/qla2xxx/qla_mr.c +10 -10
@@ -691,7 +691,7 @@ qlafx00_pci_info_str(struct scsi_qla_host *vha, char *str, size_t str_len)struct qla_hw_data *ha = vha->hw;if (pci_is_pcie (ha->pdev)) -strlcpy (str,"PCIe iSA" , str_len); +strscpy (str,"PCIe iSA" , str_len);return str; }
@@ -1850,21 +1850,21 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type) phost_info = &preg_hsi->hsi;memset (preg_hsi,0 ,sizeof (struct register_host_info )); phost_info->os_type =OS_TYPE_LINUX ; -strlcpy (phost_info->sysname, p_sysid->sysname, +strscpy (phost_info->sysname, p_sysid->sysname,sizeof (phost_info->sysname)); -strlcpy (phost_info->nodename, p_sysid->nodename, +strscpy (phost_info->nodename, p_sysid->nodename,sizeof (phost_info->nodename));if (!strcmp (phost_info->nodename,"(none)" )) ha->mr.host_info_resend = true; -strlcpy (phost_info->release, p_sysid->release, +strscpy (phost_info->release, p_sysid->release,sizeof (phost_info->release)); -strlcpy (phost_info->version, p_sysid->version, +strscpy (phost_info->version, p_sysid->version,sizeof (phost_info->version)); -strlcpy (phost_info->machine, p_sysid->machine, +strscpy (phost_info->machine, p_sysid->machine,sizeof (phost_info->machine)); -strlcpy (phost_info->domainname, p_sysid->domainname, +strscpy (phost_info->domainname, p_sysid->domainname,sizeof (phost_info->domainname)); -strlcpy (phost_info->hostdriver,QLA2XXX_VERSION , +strscpy (phost_info->hostdriver,QLA2XXX_VERSION ,sizeof (phost_info->hostdriver)); preg_hsi->utc = (uint64_t )ktime_get_real_seconds (); ql_dbg(ql_dbg_init, vha, 0x0149,
@@ -1909,9 +1909,9 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)if (fx_type ==FXDISC_GET_CONFIG_INFO ) {struct config_info_data *pinfo = (struct config_info_data *) fdisc->u.fxiocb.rsp_addr; -strlcpy (vha->hw->model_number, pinfo->model_num, +strscpy (vha->hw->model_number, pinfo->model_num,ARRAY_SIZE (vha->hw->model_number)); -strlcpy (vha->hw->model_desc, pinfo->model_description, +strscpy (vha->hw->model_desc, pinfo->model_description,ARRAY_SIZE (vha->hw->model_desc));memcpy (&vha->hw->mr.symbolic_name, pinfo->symbolic_name,sizeof (vha->hw->mr.symbolic_name));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 381/473 Input: cyapa - add missing input core locking to suspend/resume functions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
[ Upstream commit 7b4e0b39182cf5e677c1fc092a3ec40e621c25b6 ]
Grab input->mutex during suspend/resume functions like it is done in other input drivers. This fixes the following warning during system suspend/resume cycle on Samsung Exynos5250-based Snow Chromebook:
------------[ cut here ]------------ WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c Modules linked in: ... CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G W 6.6.0-rc5-next-20231009 #14109 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events_unbound async_run_entry_fn unwind_backtrace from show_stack+0x10/0x14 show_stack from dump_stack_lvl+0x58/0x70 dump_stack_lvl from __warn+0x1a8/0x1cc __warn from warn_slowpath_fmt+0x18c/0x1b4 warn_slowpath_fmt from input_device_enabled+0x68/0x6c input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c cyapa_reinitialize from cyapa_resume+0x48/0x98 cyapa_resume from dpm_run_callback+0x90/0x298 dpm_run_callback from device_resume+0xb4/0x258 device_resume from async_resume+0x20/0x64 async_resume from async_run_entry_fn+0x40/0x15c async_run_entry_fn from process_scheduled_works+0xbc/0x6a8 process_scheduled_works from worker_thread+0x188/0x454 worker_thread from kthread+0x108/0x140 kthread from ret_from_fork+0x14/0x28 Exception stack(0xf1625fb0 to 0xf1625ff8) ... ---[ end trace 0000000000000000 ]--- ... ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c Modules linked in: ... CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G W 6.6.0-rc5-next-20231009 #14109 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events_unbound async_run_entry_fn unwind_backtrace from show_stack+0x10/0x14 show_stack from dump_stack_lvl+0x58/0x70 dump_stack_lvl from __warn+0x1a8/0x1cc __warn from warn_slowpath_fmt+0x18c/0x1b4 warn_slowpath_fmt from input_device_enabled+0x68/0x6c input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c cyapa_reinitialize from cyapa_resume+0x48/0x98 cyapa_resume from dpm_run_callback+0x90/0x298 dpm_run_callback from device_resume+0xb4/0x258 device_resume from async_resume+0x20/0x64 async_resume from async_run_entry_fn+0x40/0x15c async_run_entry_fn from process_scheduled_works+0xbc/0x6a8 process_scheduled_works from worker_thread+0x188/0x454 worker_thread from kthread+0x108/0x140 kthread from ret_from_fork+0x14/0x28 Exception stack(0xf1625fb0 to 0xf1625ff8) ... ---[ end trace 0000000000000000 ]---
--- drivers/input/mouse/cyapa.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/input/mouse/cyapa.c +11 -1
@@ -1357,10 +1357,16 @@ static int __maybe_unused cyapa_suspend(struct device *dev)u8 power_mode;int error; - error =mutex_lock_interruptible (&cyapa->state_sync_lock); + error =mutex_lock_interruptible (&cyapa->input->mutex);if (error)return error; + error =mutex_lock_interruptible (&cyapa->state_sync_lock); +if (error) { +mutex_unlock (&cyapa->input->mutex); +return error; + } +/* * Runtime PM is enable only when device is in operational mode and * users in use, so need check it before disable it to
@@ -1395,6 +1401,8 @@ static int __maybe_unused cyapa_suspend(struct device *dev) cyapa->irq_wake = (enable_irq_wake (client->irq) ==0 );mutex_unlock (&cyapa->state_sync_lock); +mutex_unlock (&cyapa->input->mutex); +return 0 ; }
@@ -1404,6 +1412,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)struct cyapa *cyapa =i2c_get_clientdata (client);int error; +mutex_lock (&cyapa->input->mutex);mutex_lock (&cyapa->state_sync_lock);if (device_may_wakeup (dev) && cyapa->irq_wake) {
@@ -1422,6 +1431,7 @@ static int __maybe_unused cyapa_resume(struct device *dev)enable_irq (client->irq);mutex_unlock (&cyapa->state_sync_lock); +mutex_unlock (&cyapa->input->mutex);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 382/473 media: flexcop-usb: fix sanity check of bNumEndpoints
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dongliang Mu <[email protected]>
[ Upstream commit f62dc8f6bf82d1b307fc37d8d22cc79f67856c2f ]
Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type ") adds a sanity check for endpoint[1], but fails to modify the sanity check of bNumEndpoints.
Fix this by modifying the sanity check of bNumEndpoints to 2.
--- drivers/media/usb/b2c2/flexcop-usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/b2c2/flexcop-usb.c +1 -1
@@ -515,7 +515,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb) alt = fc_usb->uintf->cur_altsetting; -if (alt->desc.bNumEndpoints <1 ) +if (alt->desc.bNumEndpoints <2 )return -ENODEV ;if (!usb_endpoint_is_isoc_in (&alt->endpoint[0 ].desc))return -ENODEV ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 383/473 powerpc/pseries: Add failure related checks for h_get_mpp and h_get_ppp
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shrikanth Hegde <[email protected]>
[ Upstream commit 6d4341638516bf97b9a34947e0bd95035a8230a5 ]
Couple of Minor fixes:
- hcall return values are long. Fix that for h_get_mpp, h_get_ppp and parse_ppp_data
- If hcall fails, values set should be at-least zero. It shouldn't be uninitialized values. Fix that for h_get_mpp and h_get_ppp
--- arch/powerpc/include/asm/hvcall.h | 2 +- arch/powerpc/platforms/pseries/lpar.c | 6 +++--- arch/powerpc/platforms/pseries/lparcfg.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-)
arch/powerpc/include/asm/hvcall.h +1 -1
@@ -539,7 +539,7 @@ struct hvcall_mpp_data {unsigned long backing_mem; }; -int h_get_mpp (struct hvcall_mpp_data *); +long h_get_mpp (struct hvcall_mpp_data *mpp_data);struct hvcall_mpp_x_data {unsigned long coalesced_bytes;
arch/powerpc/platforms/pseries/lpar.c +3 -3
@@ -1904,10 +1904,10 @@ notrace void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf)* h_get_mpp * H_GET_MPP hcall returns info in 7 parms */ -int h_get_mpp (struct hvcall_mpp_data *mpp_data) +long h_get_mpp (struct hvcall_mpp_data *mpp_data) { -int rc; -unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ]; +unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ] = {0 }; +long rc; rc =plpar_hcall9 (H_GET_MPP , retbuf);
arch/powerpc/platforms/pseries/lparcfg.c +3 -3
@@ -112,8 +112,8 @@ struct hvcall_ppp_data {*/ static unsigned int h_get_ppp (struct hvcall_ppp_data *ppp_data) { -unsigned long rc; -unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ]; +unsigned long retbuf[PLPAR_HCALL9_BUFSIZE ] = {0 }; +long rc; rc =plpar_hcall9 (H_GET_PPP , retbuf);
@@ -192,7 +192,7 @@ static void parse_ppp_data(struct seq_file *m)struct hvcall_ppp_data ppp_data;struct device_node *root;const __be32 *perf_level; -int rc; +long rc; rc =h_get_ppp (&ppp_data);if (rc)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 384/473 um: Fix the -Wmissing-prototypes warning for __switch_mm
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 2cbade17b18c0f0fd9963f26c9fc9b057eb1cb3a ]
The __switch_mm function is defined in the user code, and is called by the kernel code. It should be declared in a shared header.
--- arch/um/include/asm/mmu.h | 2 -- arch/um/include/shared/skas/mm_id.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
arch/um/include/asm/mmu.h +0 -2
@@ -15,8 +15,6 @@ typedef struct mm_context {struct page *stub_pages[2 ]; } mm_context_t; -extern void __switch_mm (struct mm_id * mm_idp); -/* Avoid tangled inclusion with asm/ldt.h */ extern long init_new_ldt (struct mm_context *to_mm,struct mm_context *from_mm);extern void free_ldt (struct mm_context *mm);
arch/um/include/shared/skas/mm_id.h +2 -0
@@ -15,4 +15,6 @@ struct mm_id { int kill; }; +void __switch_mm (struct mm_id *mm_idp); +#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 385/473 um: Fix the -Wmissing-prototypes warning for get_thread_reg
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 3144013e48f4f6e5127223c4ebc488016815dedb ]
The get_thread_reg function is defined in the user code, and is called by the kernel code. It should be declared in a shared header.
--- arch/um/include/asm/processor-generic.h | 1 - arch/x86/um/shared/sysdep/archsetjmp.h | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
arch/um/include/asm/processor-generic.h +0 -1
@@ -95,7 +95,6 @@ extern struct cpuinfo_um boot_cpu_data;#define current_cpu_data boot_cpu_data#define cache_line_size () (boot_cpu_data.cache_alignment) -extern unsigned long get_thread_reg (int reg,jmp_buf *buf);#define KSTK_REG (tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)extern unsigned long __get_wchan (struct task_struct *p);
arch/x86/um/shared/sysdep/archsetjmp.h +7 -0
@@ -1,6 +1,13 @@/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __X86_UM_SYSDEP_ARCHSETJMP_H +#define __X86_UM_SYSDEP_ARCHSETJMP_H +#ifdef __i386__#include "archsetjmp_32.h" #else #include "archsetjmp_64.h" #endif + +unsigned long get_thread_reg (int reg,jmp_buf *buf); + +#endif /* __X86_UM_SYSDEP_ARCHSETJMP_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 386/473 um: Fix the declaration of kasan_map_memory
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiwei Bie <[email protected]>
[ Upstream commit 6a85e34c4d07d2ec0c153067baff338ac0db55ca ]
Make it match its definition (size_t vs unsigned long). And declare it in a shared header to fix the -Wmissing-prototypes warning, as it is defined in the user code and called in the kernel code.
--- arch/um/include/asm/kasan.h | 1 - arch/um/include/shared/kern_util.h | 2 ++ arch/um/os-Linux/mem.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
arch/um/include/asm/kasan.h +0 -1
@@ -24,7 +24,6 @@#ifdef CONFIG_KASAN void kasan_init (void ); -void kasan_map_memory (void *start,unsigned long len);extern int kasan_um_is_ready;#ifdef CONFIG_STATIC_LINK
arch/um/include/shared/kern_util.h +2 -0
@@ -67,4 +67,6 @@ extern void fatal_sigsegv(void) __attribute__ ((noreturn));void um_idle_sleep (void ); +void kasan_map_memory (void *start,size_t len); +#endif
arch/um/os-Linux/mem.c +1 -0
@@ -15,6 +15,7 @@#include <sys/vfs.h> #include <linux/magic.h> #include <init.h> +#include <kern_util.h> #include <os.h> /*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 387/473 media: sunxi: a83-mips-csi2: also select GENERIC_PHY
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 8237026159cb6760ad22e28d57b9a1c53b612d3a ]
When selecting GENERIC_PHY_MIPI_DPHY, also select GENERIC_PHY to prevent kconfig warnings:
WARNING: unmet direct dependencies detected for GENERIC_PHY_MIPI_DPHY
Depends on [n]: GENERIC_PHY [=n]
Selected by [y]:
- VIDEO_SUN8I_A83T_MIPI_CSI2 [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && MEDIA_PLATFORM_DRIVERS [=y] && V4L_PLATFORM_DRIVERS [=y] && VIDEO_DEV [=y] && (ARCH_SUNXI || COMPILE_TEST [=y]) && PM [=y] && COMMON_CLK [=y] && RESET_CONTROLLER [=y]
--- drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig +1 -0
@@ -8,6 +8,7 @@ config VIDEO_SUN8I_A83T_MIPI_CSI2 select VIDEO_V4L2_SUBDEV_API select V4L2_FWNODE select REGMAP_MMIO + select GENERIC_PHY select GENERIC_PHY_MIPI_DPHY help Support for the Allwinner A83T MIPI CSI-2 controller and D-PHY.
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 388/473 media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 9fe2816816a3c765dff3b88af5b5c3d9bbb911ce ]
Do not check for !data->completed, just always call cancel_delayed_work_sync(). This fixes a small race condition.
--- drivers/media/cec/core/cec-adap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/cec/core/cec-adap.c +1 -2
@@ -909,8 +909,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,*/ mutex_unlock (&adap->lock);wait_for_completion_killable (&data->c); -if (!data->completed) -cancel_delayed_work_sync (&data->work); +cancel_delayed_work_sync (&data->work);mutex_lock (&adap->lock);/* Cancel the transmit if it was interrupted */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 389/473 media: cec: cec-api: add locking in cec_release()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 42bcaacae924bf18ae387c3f78c202df0b739292 ]
When cec_release() uses fh->msgs it has to take fh->lock, otherwise the list can get corrupted.
--- drivers/media/cec/core/cec-api.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/cec/core/cec-api.c +3 -0
@@ -664,6 +664,8 @@ static int cec_release(struct inode *inode, struct file *filp)list_del_init (&data->xfer_list); }mutex_unlock (&adap->lock); + +mutex_lock (&fh->lock);while (!list_empty (&fh->msgs)) {struct cec_msg_entry *entry = list_first_entry(&fh->msgs, struct cec_msg_entry, list);
@@ -681,6 +683,7 @@ static int cec_release(struct inode *inode, struct file *filp)kfree (entry); } } +mutex_unlock (&fh->lock);kfree (fh);cec_put_device (devnode);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 390/473 media: cec: core: avoid recursive cec_claim_log_addrs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit 47c82aac10a6954d68f29f10d9758d016e8e5af1 ]
Keep track if cec_claim_log_addrs() is running, and return -EBUSY if it is when calling CEC_ADAP_S_LOG_ADDRS.
This prevents a case where cec_claim_log_addrs() could be called while it was still in progress.
--- drivers/media/cec/core/cec-adap.c | 6 +++++- drivers/media/cec/core/cec-api.c | 2 +- include/media/cec.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/media/cec/core/cec-adap.c +5 -1
@@ -1544,9 +1544,12 @@ static int cec_config_thread_func(void *arg)*/ static void cec_claim_log_addrs (struct cec_adapter *adap,bool block) { -if (WARN_ON (adap->is_configuring || adap->is_configured)) +if (WARN_ON (adap->is_claiming_log_addrs || + adap->is_configuring || adap->is_configured))return ; + adap->is_claiming_log_addrs = true; +init_completion (&adap->config_completion);/* Ready to kick off the thread */
@@ -1561,6 +1564,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)wait_for_completion (&adap->config_completion);mutex_lock (&adap->lock); } + adap->is_claiming_log_addrs = false; }/*
drivers/media/cec/core/cec-api.c +1 -1
@@ -178,7 +178,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU |CEC_LOG_ADDRS_FL_CDC_ONLY ;mutex_lock (&adap->lock); -if (!adap->is_configuring && +if (!adap->is_claiming_log_addrs && !adap->is_configuring && (!log_addrs.num_log_addrs || !adap->is_configured) && !cec_is_busy (adap, fh)) { err =__cec_s_log_addrs (adap, &log_addrs, block);
include/media/cec.h +1 -0
@@ -247,6 +247,7 @@ struct cec_adapter {u16 phys_addr;bool needs_hpd;bool is_enabled; +bool is_claiming_log_addrs;bool is_configuring;bool must_reconfigure;bool is_configured;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 391/473 media: cec: core: avoid confusing "transmit timed out" message
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit cbe499977bc36fedae89f0a0d7deb4ccde9798fe ]
If, when waiting for a transmit to finish, the wait is interrupted, then you might get a "transmit timed out" message, even though the transmit was interrupted and did not actually time out.
Set transmit_in_progress_aborted to true if the wait_for_completion_killable() call was interrupted and ensure that the transmit is properly marked as ABORTED.
--- drivers/media/cec/core/cec-adap.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/media/cec/core/cec-adap.c +14 -1
@@ -490,6 +490,15 @@ int cec_thread_func(void *_adap) goto unlock; } +if (adap->transmit_in_progress && + adap->transmit_in_progress_aborted) { +if (adap->transmitting) +cec_data_cancel (adap->transmitting, +CEC_TX_STATUS_ABORTED ,0 ); + adap->transmit_in_progress = false; + adap->transmit_in_progress_aborted = false; + goto unlock; + }if (adap->transmit_in_progress && timeout) {/* * If we timeout, then log that. Normally this does
@@ -744,6 +753,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, {struct cec_data *data;bool is_raw =msg_is_raw (msg); +int err;if (adap->devnode.unregistered)return -ENODEV ;
@@ -908,10 +918,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,* Release the lock and wait, retake the lock afterwards. */ mutex_unlock (&adap->lock); -wait_for_completion_killable (&data->c); + err =wait_for_completion_killable (&data->c);cancel_delayed_work_sync (&data->work);mutex_lock (&adap->lock); +if (err) + adap->transmit_in_progress_aborted = true; +/* Cancel the transmit if it was interrupted */ if (!data->completed) {if (data->msg.tx_status &CEC_TX_STATUS_OK )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 392/473 Revert "drm/bridge: ti-sn65dsi83: Fix enable error path"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Ceresoli <[email protected]>
[ Upstream commit ad81feb5b6f1f5461641706376dcf7a9914ed2e7 ]
This reverts commit 8a91b29f1f50ce7742cdbe5cf11d17f128511f3f.
The regulator_disable() added by the original commit solves one kind of regulator imbalance but adds another one as it allows the regulator to be disabled one more time than it is enabled in the following scenario:
1. Start video pipeline -> sn65dsi83_atomic_pre_enable -> regulator_enable
2. PLL lock fails -> regulator_disable
3. Stop video pipeline -> sn65dsi83_atomic_disable -> regulator_disable
The reason is clear from the code flow, which looks like this (after removing unrelated code):
static void sn65dsi83_atomic_pre_enable()
{
regulator_enable(ctx->vcc); if (PLL failed locking) {
regulator_disable(ctx->vcc); <---- added by patch being reverted
return;
}}
static void sn65dsi83_atomic_disable()
{
regulator_disable(ctx->vcc);
}The use case for introducing the additional regulator_disable() was removing the module for debugging (see link below for the discussion). If the module is removed after a .atomic_pre_enable, i.e. with an active pipeline from the DRM point of view, .atomic_disable is not called and thus the regulator would not be disabled.
According to the discussion however there is no actual use case for removing the module with an active pipeline, except for debugging/development.
On the other hand, the occurrence of a PLL lock failure is possible due to any physical reason (e.g. a temporary hardware failure for electrical reasons) so handling it gracefully should be supported. As there is no way for .atomic[_pre]_enable to report an error to the core, the only clean way to support it is calling regulator_disabled() only in .atomic_disable, unconditionally, as it was before.
--- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/bridge/ti-sn65dsi83.c +0 -1
@@ -478,7 +478,6 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,dev_err (ctx->dev,"failed to lock PLL, ret=%i\n" , ret);/* On failure, disable PLL again and exit. */ regmap_write (ctx->regmap,REG_RC_PLL_EN ,0x00 ); -regulator_disable (ctx->vcc);return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 393/473 drm/msm: Enable clamp_to_idle for 7c3
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 2c1b7748100e2e40155722589201f24c23ae5d53 ]
This was overlooked.
Patchwork: https://patchwork.freedesktop.org/patch/511693/
Stable-dep-of: 46d4efcccc68 ("drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails")
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +7 -7
@@ -2036,13 +2036,6 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) adreno_cmp_rev(ADRENO_REV(6, 3, 5, ANY_ID), info->rev))) adreno_gpu->base.hw_apriv = true; -/* -* For now only clamp to idle freq for devices where this is known not -* to cause power supply issues: -*/ -if (info && (info->revn ==618 )) - gpu->clamp_to_idle = true; -a6xx_llc_slices_init (pdev, a6xx_gpu); ret =a6xx_set_supported_hw (&pdev->dev, config->rev);
@@ -2057,6 +2050,13 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)return ERR_PTR (ret); } +/* +* For now only clamp to idle freq for devices where this is known not +* to cause power supply issues: +*/ +if (adreno_is_a618 (adreno_gpu) ||adreno_is_7c3 (adreno_gpu)) + gpu->clamp_to_idle = true; +/* Check if there is a GMU phandle and set it up */ node =of_parse_phandle (pdev->dev.of_node,"qcom,gmu" ,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 394/473 drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 46d4efcccc688cbacdd70a238bedca510acaa8e4 ]
Calling a6xx_destroy() before adreno_gpu_init() leads to a null pointer dereference on:
msm_gpu_cleanup() : platform_set_drvdata(gpu->pdev, NULL);
as gpu->pdev is only assigned in:
a6xx_gpu_init()
|_ adreno_gpu_init
|_ msm_gpu_init()
Instead of relying on handwavy null checks down the cleanup chain, explicitly de-allocate the LLC data and free a6xx_gpu instead.
Patchwork: https://patchwork.freedesktop.org/patch/588919/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +2 -1
@@ -2040,7 +2040,8 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) ret =a6xx_set_supported_hw (&pdev->dev, config->rev);if (ret) { -a6xx_destroy (&(a6xx_gpu->base.base)); +a6xx_llc_slices_destroy (a6xx_gpu); +kfree (a6xx_gpu);return ERR_PTR (ret); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 395/473 null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhu Yanjun <[email protected]>
[ Upstream commit 9e6727f824edcdb8fdd3e6e8a0862eb49546e1cd ]
No functional changes intended.
--- drivers/block/null_blk/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/block/null_blk/main.c +1 -0
@@ -2306,4 +2306,5 @@ module_init(null_init);module_exit (null_exit);MODULE_AUTHOR ("Jens Axboe <[email protected]>" ); +MODULE_DESCRIPTION ("multi queue aware block test driver" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 396/473 nilfs2: make superblock data array index computation sparse friendly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
[ Upstream commit 91d743a9c8299de1fc1b47428d8bb4c85face00f ]
Upon running sparse, "warning: dubious: x & !y" is output at an array index calculation within nilfs_load_super_block().
The calculation is not wrong, but to eliminate the sparse warning, replace it with an equivalent calculation.
Also, add a comment to make it easier to understand what the unintuitive array index calculation is doing and whether it's correct.
--- fs/nilfs2/the_nilfs.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
fs/nilfs2/the_nilfs.c +18 -2
@@ -592,7 +592,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,struct nilfs_super_block **sbp = nilfs->ns_sbp;struct buffer_head **sbh = nilfs->ns_sbh;u64 sb2off, devsize =bdev_nr_bytes (nilfs->ns_bdev); -int valid[2 ], swp =0 ; +int valid[2 ], swp =0 , older;if (devsize <NILFS_SEG_MIN_BLOCKS *NILFS_MIN_BLOCK_SIZE +4096 ) {nilfs_err (sb,"device size too small" );
@@ -648,9 +648,25 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,if (swp)nilfs_swap_super_block (nilfs); +/* +* Calculate the array index of the older superblock data. +* If one has been dropped, set index 0 pointing to the remaining one, +* otherwise set index 1 pointing to the old one (including if both +* are the same). +* +* Divided case valid[0] valid[1] swp -> older +* ------------------------------------------------------------- +* Both SBs are invalid 0 0 N/A (Error) +* SB1 is invalid 0 1 1 0 +* SB2 is invalid 1 0 0 0 +* SB2 is newer 1 1 1 0 +* SB2 is older or the same 1 1 0 1 +*/ + older = valid[1 ] ^ swp; + nilfs->ns_sbwcount =0 ; nilfs->ns_sbwtime =le64_to_cpu (sbp[0 ]->s_wtime); - nilfs->ns_prot_seq =le64_to_cpu (sbp[valid[1 ] & !swp]->s_last_seq); + nilfs->ns_prot_seq =le64_to_cpu (sbp[older]->s_last_seq); *sbpp = sbp[0 ];return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 397/473 ALSA: hda/cs_dsp_ctl: Use private_free for control cleanup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Richard Fitzgerald <[email protected]>
[ Upstream commit 172811e3a557d8681a5e2d0f871dc04a2d17eb13 ]
Use the control private_free callback to free the associated data block. This ensures that the memory won't leak, whatever way the control gets destroyed.
The original implementation didn't actually remove the ALSA controls in hda_cs_dsp_control_remove(). It only freed the internal tracking structure. This meant it was possible to remove/unload the amp driver while leaving its ALSA controls still present in the soundcard. Obviously attempting to access them could cause segfaults or at least dereferencing stale pointers.
--- sound/pci/hda/hda_cs_dsp_ctl.c | 47 ++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 16 deletions(-)
sound/pci/hda/hda_cs_dsp_ctl.c +31 -16
@@ -8,6 +8,7 @@#include <linux/module.h> #include <sound/soc.h> +#include <linux/cleanup.h> #include <linux/firmware/cirrus/cs_dsp.h> #include <linux/firmware/cirrus/wmfw.h> #include "hda_cs_dsp_ctl.h"
@@ -97,11 +98,23 @@ static unsigned int wmfw_convert_flags(unsigned int in)return out; } -static void hda_cs_dsp_add_kcontrol (struct hda_cs_dsp_coeff_ctl *ctl,const char *name) +static void hda_cs_dsp_free_kcontrol (struct snd_kcontrol *kctl) { +struct hda_cs_dsp_coeff_ctl *ctl = (struct hda_cs_dsp_coeff_ctl *)snd_kcontrol_chip (kctl);struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl; + +/* NULL priv to prevent a double-free in hda_cs_dsp_control_remove() */ + cs_ctl->priv =NULL ; +kfree (ctl); +} + +static void hda_cs_dsp_add_kcontrol (struct cs_dsp_coeff_ctl *cs_ctl, +const struct hda_cs_dsp_ctl_info *info, +const char *name) +{struct snd_kcontrol_new kcontrol = {0 };struct snd_kcontrol *kctl; + struct hda_cs_dsp_coeff_ctl *ctl __free(kfree) = NULL;int ret =0 ;if (cs_ctl->len >ADSP_MAX_STD_CTRL_SIZE ) {
@@ -110,6 +123,13 @@ static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const charreturn ; } + ctl =kzalloc (sizeof (*ctl),GFP_KERNEL ); +if (!ctl) +return ; + + ctl->cs_ctl = cs_ctl; + ctl->card = info->card; + kcontrol.name = name; kcontrol.info = hda_cs_dsp_coeff_info; kcontrol.iface =SNDRV_CTL_ELEM_IFACE_MIXER ;
@@ -117,20 +137,22 @@ static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char kcontrol.get = hda_cs_dsp_coeff_get; kcontrol.put = hda_cs_dsp_coeff_put; -/* Save ctl inside private_data, ctl is owned by cs_dsp, -* and will be freed when cs_dsp removes the control */ kctl =snd_ctl_new1 (&kcontrol, (void *)ctl);if (!kctl)return ; - ret =snd_ctl_add (ctl->card, kctl); + kctl->private_free = hda_cs_dsp_free_kcontrol; + ctl->kctl = kctl; + +/* snd_ctl_add() calls our private_free on error, which will kfree(ctl) */ + cs_ctl->priv =no_free_ptr (ctl); + ret =snd_ctl_add (info->card, kctl);if (ret) {dev_err (cs_ctl->dsp->dev,"Failed to add KControl %s = %d\n" , kcontrol.name, ret);return ; }dev_dbg (cs_ctl->dsp->dev,"Added KControl: %s\n" , kcontrol.name); - ctl->kctl = kctl; } static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
@@ -138,7 +160,6 @@ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl, {struct cs_dsp *cs_dsp = cs_ctl->dsp;char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN ]; -struct hda_cs_dsp_coeff_ctl *ctl;const char *region_name;int ret;
@@ -163,15 +184,7 @@ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl, " %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip); } - ctl =kzalloc (sizeof (*ctl),GFP_KERNEL ); -if (!ctl) -return ; - - ctl->cs_ctl = cs_ctl; - ctl->card = info->card; - cs_ctl->priv = ctl; - -hda_cs_dsp_add_kcontrol (ctl, name); +hda_cs_dsp_add_kcontrol (cs_ctl, info, name); }void hda_cs_dsp_add_controls (struct cs_dsp *dsp,const struct hda_cs_dsp_ctl_info *info)
@@ -203,7 +216,9 @@ void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl) {struct hda_cs_dsp_coeff_ctl *ctl = cs_ctl->priv; -kfree (ctl); +/* ctl and kctl may already have been removed by ALSA private_free */ +if (ctl && ctl->kctl) +snd_ctl_remove (ctl->card, ctl->kctl); }EXPORT_SYMBOL_NS_GPL (hda_cs_dsp_control_remove,SND_HDA_CS_DSP_CONTROLS );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 398/473 ASoC: mediatek: mt8192: fix register configuration for tdm
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hsin-Te Yuan <[email protected]>
[ Upstream commit a85ed162f0efcfdd664954414a05d1d560cc95dc ]
For DSP_A, data is a BCK cycle behind LRCK trigger edge. For DSP_B, this delay doesn't exist. Fix the delay configuration to match the standard.
--- sound/soc/mediatek/mt8192/mt8192-dai-tdm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt8192/mt8192-dai-tdm.c +2 -2
@@ -566,10 +566,10 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream, tdm_con |=1 <<DELAY_DATA_SFT ; tdm_con |=get_tdm_lrck_width (format) <<LRCK_TDM_WIDTH_SFT ; }else if (tdm_priv->tdm_out_mode ==TDM_OUT_DSP_A ) { - tdm_con |=0 <<DELAY_DATA_SFT ; + tdm_con |=1 <<DELAY_DATA_SFT ; tdm_con |=0 <<LRCK_TDM_WIDTH_SFT ; }else if (tdm_priv->tdm_out_mode ==TDM_OUT_DSP_B ) { - tdm_con |=1 <<DELAY_DATA_SFT ; + tdm_con |=0 <<DELAY_DATA_SFT ; tdm_con |=0 <<LRCK_TDM_WIDTH_SFT ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 399/473 regulator: bd71828: Dont overwrite runtime voltages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matti Vaittinen <[email protected]>
[ Upstream commit 0f9f7c63c415e287cd57b5c98be61eb320dedcfc ]
Some of the regulators on the BD71828 have common voltage setting for RUN/SUSPEND/IDLE/LPSR states. The enable control can be set for each state though.
The driver allows setting the voltage values for these states via device-tree. As a side effect, setting the voltages for SUSPEND/IDLE/LPSR will also change the RUN level voltage which is not desired and can break the system.
The comment in code reflects this behaviour, but it is likely to not make people any happier. The right thing to do is to allow setting the enable/disable state at SUSPEND/IDLE/LPSR via device-tree, but to disallow setting state specific voltages for those regulators.
BUCK1 is a bit different. It only shares the SUSPEND and LPSR state voltages. The former behaviour of allowing to silently overwrite the SUSPEND state voltage by LPSR state voltage is also changed here so that the SUSPEND voltage is prioritized over LPSR voltage.
Prevent setting PMIC state specific voltages for regulators which do not support it.
--- drivers/regulator/bd71828-regulator.c | 58 +-------------------------- 1 file changed, 2 insertions(+), 56 deletions(-)
drivers/regulator/bd71828-regulator.c +2 -56
@@ -207,14 +207,11 @@ static const struct bd71828_regulator_data bd71828_rdata[] = { .suspend_reg = BD71828_REG_BUCK1_SUSP_VOLT, .suspend_mask = BD71828_MASK_BUCK1267_VOLT, .suspend_on_mask = BD71828_MASK_SUSP_EN, - .lpsr_on_mask = BD71828_MASK_LPSR_EN,/* * LPSR voltage is same as SUSPEND voltage. Allow -* setting it so that regulator can be set enabled at -* LPSR state +* only enabling/disabling regulator for LPSR state */ - .lpsr_reg = BD71828_REG_BUCK1_SUSP_VOLT, - .lpsr_mask = BD71828_MASK_BUCK1267_VOLT, + .lpsr_on_mask = BD71828_MASK_LPSR_EN, }, .reg_inits = buck1_inits, .reg_init_amnt = ARRAY_SIZE(buck1_inits),
@@ -289,13 +286,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_BUCK3_VOLT, - .idle_reg = BD71828_REG_BUCK3_VOLT, - .suspend_reg = BD71828_REG_BUCK3_VOLT, - .lpsr_reg = BD71828_REG_BUCK3_VOLT, .run_mask = BD71828_MASK_BUCK3_VOLT, - .idle_mask = BD71828_MASK_BUCK3_VOLT, - .suspend_mask = BD71828_MASK_BUCK3_VOLT, - .lpsr_mask = BD71828_MASK_BUCK3_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -330,13 +321,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_BUCK4_VOLT, - .idle_reg = BD71828_REG_BUCK4_VOLT, - .suspend_reg = BD71828_REG_BUCK4_VOLT, - .lpsr_reg = BD71828_REG_BUCK4_VOLT, .run_mask = BD71828_MASK_BUCK4_VOLT, - .idle_mask = BD71828_MASK_BUCK4_VOLT, - .suspend_mask = BD71828_MASK_BUCK4_VOLT, - .lpsr_mask = BD71828_MASK_BUCK4_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -371,13 +356,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_BUCK5_VOLT, - .idle_reg = BD71828_REG_BUCK5_VOLT, - .suspend_reg = BD71828_REG_BUCK5_VOLT, - .lpsr_reg = BD71828_REG_BUCK5_VOLT, .run_mask = BD71828_MASK_BUCK5_VOLT, - .idle_mask = BD71828_MASK_BUCK5_VOLT, - .suspend_mask = BD71828_MASK_BUCK5_VOLT, - .lpsr_mask = BD71828_MASK_BUCK5_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -494,13 +473,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_LDO1_VOLT, - .idle_reg = BD71828_REG_LDO1_VOLT, - .suspend_reg = BD71828_REG_LDO1_VOLT, - .lpsr_reg = BD71828_REG_LDO1_VOLT, .run_mask = BD71828_MASK_LDO_VOLT, - .idle_mask = BD71828_MASK_LDO_VOLT, - .suspend_mask = BD71828_MASK_LDO_VOLT, - .lpsr_mask = BD71828_MASK_LDO_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -534,13 +507,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_LDO2_VOLT, - .idle_reg = BD71828_REG_LDO2_VOLT, - .suspend_reg = BD71828_REG_LDO2_VOLT, - .lpsr_reg = BD71828_REG_LDO2_VOLT, .run_mask = BD71828_MASK_LDO_VOLT, - .idle_mask = BD71828_MASK_LDO_VOLT, - .suspend_mask = BD71828_MASK_LDO_VOLT, - .lpsr_mask = BD71828_MASK_LDO_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -574,13 +541,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_LDO3_VOLT, - .idle_reg = BD71828_REG_LDO3_VOLT, - .suspend_reg = BD71828_REG_LDO3_VOLT, - .lpsr_reg = BD71828_REG_LDO3_VOLT, .run_mask = BD71828_MASK_LDO_VOLT, - .idle_mask = BD71828_MASK_LDO_VOLT, - .suspend_mask = BD71828_MASK_LDO_VOLT, - .lpsr_mask = BD71828_MASK_LDO_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -615,13 +576,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_LDO4_VOLT, - .idle_reg = BD71828_REG_LDO4_VOLT, - .suspend_reg = BD71828_REG_LDO4_VOLT, - .lpsr_reg = BD71828_REG_LDO4_VOLT, .run_mask = BD71828_MASK_LDO_VOLT, - .idle_mask = BD71828_MASK_LDO_VOLT, - .suspend_mask = BD71828_MASK_LDO_VOLT, - .lpsr_mask = BD71828_MASK_LDO_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -656,13 +611,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {ROHM_DVS_LEVEL_SUSPEND | ROHM_DVS_LEVEL_LPSR, .run_reg = BD71828_REG_LDO5_VOLT, - .idle_reg = BD71828_REG_LDO5_VOLT, - .suspend_reg = BD71828_REG_LDO5_VOLT, - .lpsr_reg = BD71828_REG_LDO5_VOLT, .run_mask = BD71828_MASK_LDO_VOLT, - .idle_mask = BD71828_MASK_LDO_VOLT, - .suspend_mask = BD71828_MASK_LDO_VOLT, - .lpsr_mask = BD71828_MASK_LDO_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
@@ -721,9 +670,6 @@ static const struct bd71828_regulator_data bd71828_rdata[] = { .suspend_reg = BD71828_REG_LDO7_VOLT, .lpsr_reg = BD71828_REG_LDO7_VOLT, .run_mask = BD71828_MASK_LDO_VOLT, - .idle_mask = BD71828_MASK_LDO_VOLT, - .suspend_mask = BD71828_MASK_LDO_VOLT, - .lpsr_mask = BD71828_MASK_LDO_VOLT, .idle_on_mask = BD71828_MASK_IDLE_EN, .suspend_on_mask = BD71828_MASK_SUSP_EN, .lpsr_on_mask = BD71828_MASK_LPSR_EN,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 400/473 perf/arm-dmc620: Fix lockdep assert in ->event_init()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Namhyung Kim <[email protected]>
[ Upstream commit a4c5a457c6107dfe9dc65a104af1634811396bac ]
for_each_sibling_event() checks leader's ctx but it doesn't have the ctx yet if it's the leader. Like in perf_event_validate_size(), we should skip checking siblings in that case.
--- drivers/perf/arm_dmc620_pmu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/perf/arm_dmc620_pmu.c +6 -3
@@ -513,12 +513,16 @@ static int dmc620_pmu_event_init(struct perf_event *event)if (event->cpu <0 )return -EINVAL ; + hwc->idx =-1 ; + +if (event->group_leader == event) +return 0 ; +/* * We can't atomically disable all HW counters so only one event allowed, * although software events are acceptable. */ -if (event->group_leader != event && - !is_software_event (event->group_leader)) +if (!is_software_event (event->group_leader))return -EINVAL ;for_each_sibling_event (sibling, event->group_leader) {
@@ -527,7 +531,6 @@ static int dmc620_pmu_event_init(struct perf_event *event)return -EINVAL ; } - hwc->idx =-1 ;return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 401/473 x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 66ee3636eddcc82ab82b539d08b85fb5ac1dff9b ]
It took me some time to understand the purpose of the tricky code at the end of arch/x86/Kconfig.debug.
Without it, the following would be shown:
WARNING: unmet direct dependencies detected for FRAME_POINTER
because
81d387190039 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
removed 'select ARCH_WANT_FRAME_POINTERS'.
The correct and more straightforward approach should have been to move it where 'select FRAME_POINTER' is located.
Several architectures properly handle the conditional selection of ARCH_WANT_FRAME_POINTERS. For example, 'config UNWINDER_FRAME_POINTER' in arch/arm/Kconfig.debug.
--- arch/x86/Kconfig.debug | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/Kconfig.debug +1 -4
@@ -248,6 +248,7 @@ config UNWINDER_ORC config UNWINDER_FRAME_POINTER bool "Frame pointer unwinder" + select ARCH_WANT_FRAME_POINTERS select FRAME_POINTER help This option enables the frame pointer unwinder for unwinding kernel
@@ -271,7 +272,3 @@ config UNWINDER_GUESS overhead. endchoice - -config FRAME_POINTER - depends on !UNWINDER_ORC && !UNWINDER_GUESS - bool
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 402/473 net: Always descend into dsa/ folder with CONFIG_NET_DSA enabled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit b1fa60ec252fba39130107074becd12d0b3f83ec ]
Stephen reported that he was unable to get the dsa_loop driver to get probed, and the reason ended up being because he had CONFIG_FIXED_PHY=y in his kernel configuration. As Masahiro explained it:
"obj-m += dsa/" means everything under dsa/ must be modular.
If there is a built-in object under dsa/ with CONFIG_NET_DSA=m, you cannot do "obj-$(CONFIG_NET_DSA) += dsa/".
You need to change it back to "obj-y += dsa/".
This was the case here whereby CONFIG_NET_DSA=m, and so the obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o rule is not executed and the DSA loop mdio_board info structure is not registered with the kernel, and eventually the device is simply not found.
To preserve the intention of the original commit of limiting the amount of folder descending, conditionally descend into drivers/net/dsa when CONFIG_NET_DSA is enabled.
--- drivers/net/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/Makefile +3 -1
@@ -48,7 +48,9 @@ obj-$(CONFIG_ARCNET) += arcnet/ obj-$(CONFIG_DEV_APPLETALK) += appletalk/ obj-$(CONFIG_CAIF) += caif/ obj-$(CONFIG_CAN) += can/ -obj-$(CONFIG_NET_DSA) += dsa/ +ifdef CONFIG_NET_DSA +obj-y += dsa/ +endif obj-$(CONFIG_ETHERNET) += ethernet/ obj-$(CONFIG_FDDI) += fddi/ obj-$(CONFIG_HIPPI) += hippi/
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 403/473 ipv6: sr: fix missing sk_buff release in seg6_input_core
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrea Mayer <[email protected]>
[ Upstream commit 5447f9708d9e4c17a647b16a9cb29e9e02820bd9 ]
The seg6_input() function is responsible for adding the SRH into a packet, delegating the operation to the seg6_input_core(). This function uses the skb_cow_head() to ensure that there is sufficient headroom in the sk_buff for accommodating the link-layer header.
In the event that the skb_cow_header() function fails, the seg6_input_core() catches the error but it does not release the sk_buff, which will result in a memory leak.
This issue was introduced in commit af3b5158b89d ("ipv6: sr: fix BUG due to headroom too small after SRH push") and persists even after commit 7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane"), where the entire seg6_input() code was refactored to deal with netfilter hooks.
The proposed patch addresses the identified memory leak by requiring the seg6_input_core() function to release the sk_buff in the event that skb_cow_head() fails.
--- net/ipv6/seg6_iptunnel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
net/ipv6/seg6_iptunnel.c +6 -5
@@ -459,10 +459,8 @@ static int seg6_input_core(struct net *net, struct sock *sk,int err; err =seg6_do_srh (skb); -if (unlikely (err)) { -kfree_skb (skb); -return err; - } +if (unlikely (err)) + goto drop; slwt =seg6_lwt_lwtunnel (orig_dst->lwtstate);
@@ -487,7 +485,7 @@ static int seg6_input_core(struct net *net, struct sock *sk, err =skb_cow_head (skb,LL_RESERVED_SPACE (dst->dev));if (unlikely (err)) -return err; + goto drop;if (static_branch_unlikely (&nf_hooks_lwtunnel_enabled)) return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
@@ -495,6 +493,9 @@ static int seg6_input_core(struct net *net, struct sock *sk, skb_dst(skb)->dev, seg6_input_finish);return seg6_input_finish (dev_net (skb->dev),NULL , skb); +drop: +kfree_skb (skb); +return err; }static int seg6_input_nf (struct sk_buff *skb)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 404/473 selftests: net: kill smcrouted in the cleanup logic in amt.sh
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <[email protected]>
[ Upstream commit cc563e749810f5636451d4b833fbd689899ecdb9 ]
The amt.sh requires smcrouted for multicasting routing. So, it starts smcrouted before forwarding tests. It must be stopped after all tests, but it isn't.
To fix this issue, it kills smcrouted in the cleanup logic.
--- tools/testing/selftests/net/amt.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/testing/selftests/net/amt.sh +7 -1
@@ -77,6 +77,7 @@ readonly LISTENER=$(mktemp -u listener-XXXXXXXX) readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX) readonly RELAY=$(mktemp -u relay-XXXXXXXX) readonly SOURCE=$(mktemp -u source-XXXXXXXX) +readonly SMCROUTEDIR="$(mktemp -d)" ERR=4 err=0
@@ -85,6 +86,11 @@ exit_cleanup() for ns in "$@"; do ip netns delete "${ns}" 2>/dev/null || true done + if [ -f "$SMCROUTEDIR/amt.pid" ]; then + smcpid=$(< $SMCROUTEDIR/amt.pid) + kill $smcpid + fi + rm -rf $SMCROUTEDIR exit $ERR }
@@ -167,7 +173,7 @@ setup_iptables() setup_mcast_routing() { - ip netns exec "${RELAY}" smcrouted + ip netns exec "${RELAY}" smcrouted -P $SMCROUTEDIR/amt.pid ip netns exec "${RELAY}" smcroutectl a relay_src \ 172.17.0.2 239.0.0.1 amtr ip netns exec "${RELAY}" smcroutectl a relay_src \
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 405/473 nfc: nci: Fix uninit-value in nci_rx_work
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryosuke Yasuoka <[email protected]>
[ Upstream commit e4a87abf588536d1cdfb128595e6e680af5cf3ed ]
syzbot reported the following uninit-value access issue [1]
nci_rx_work() parses received packet from ndev->rx_q. It should be validated header size, payload size and total packet size before processing the packet. If an invalid packet is detected, it should be silently discarded.
--- net/nfc/nci/core.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
net/nfc/nci/core.c +14 -1
@@ -1462,6 +1462,19 @@ int nci_core_ntf_packet(struct nci_dev *ndev, __u16 opcode, ndev->ops->n_core_ops); } +static bool nci_valid_size (struct sk_buff *skb) +{ +BUILD_BUG_ON (NCI_CTRL_HDR_SIZE !=NCI_DATA_HDR_SIZE ); +unsigned int hdr_size =NCI_CTRL_HDR_SIZE ; + +if (skb->len < hdr_size || + !nci_plen (skb->data) || + skb->len < hdr_size +nci_plen (skb->data)) { +return false; + } +return true; +} +/* ---- NCI TX Data worker thread ---- */ static void nci_tx_work (struct work_struct *work)
@@ -1512,7 +1525,7 @@ static void nci_rx_work(struct work_struct *work)nfc_send_to_raw_sock (ndev->nfc_dev, skb,RAW_PAYLOAD_NCI ,NFC_DIRECTION_RX ); -if (!nci_plen (skb->data)) { +if (!nci_valid_size (skb)) {kfree_skb (skb);break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 406/473 ASoC: tas2552: Add TX path for capturing AUDIO-OUT data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenghao Ding <[email protected]>
[ Upstream commit 7078ac4fd179a68d0bab448004fcd357e7a45f8d ]
TAS2552 is a Smartamp with I/V sense data, add TX path to support capturing I/V data.
--- sound/soc/codecs/tas2552.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
sound/soc/codecs/tas2552.c +13 -2
@@ -2,7 +2,8 @@/* * tas2552.c - ALSA SoC Texas Instruments TAS2552 Mono Audio Amplifier * -* Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com +* Copyright (C) 2014 - 2024 Texas Instruments Incorporated - +* https://www.ti.com * * Author: Dan Murphy <[email protected]> */
@@ -119,12 +120,14 @@ static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] = &tas2552_input_mux_control),SND_SOC_DAPM_AIF_IN ("DAC IN" ,"DAC Playback" ,0 ,SND_SOC_NOPM ,0 ,0 ), +SND_SOC_DAPM_AIF_OUT ("ASI OUT" ,"DAC Capture" ,0 ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_DAC ("DAC" ,NULL ,SND_SOC_NOPM ,0 ,0 ),SND_SOC_DAPM_OUT_DRV ("ClassD" ,TAS2552_CFG_2 ,7 ,0 ,NULL ,0 ),SND_SOC_DAPM_SUPPLY ("PLL" ,TAS2552_CFG_2 ,3 ,0 ,NULL ,0 ),SND_SOC_DAPM_POST ("Post Event" , tas2552_post_event), -SND_SOC_DAPM_OUTPUT ("OUT" ) +SND_SOC_DAPM_OUTPUT ("OUT" ), +SND_SOC_DAPM_INPUT ("DMIC" ) }; static const struct snd_soc_dapm_route tas2552_audio_map[] = {
@@ -134,6 +137,7 @@ static const struct snd_soc_dapm_route tas2552_audio_map[] = { {"ClassD", NULL, "Input selection"}, {"OUT", NULL, "ClassD"}, {"ClassD", NULL, "PLL"}, + {"ASI OUT", NULL, "DMIC"} };#ifdef CONFIG_PM
@@ -538,6 +542,13 @@ static struct snd_soc_dai_driver tas2552_dai[] = { .rates = SNDRV_PCM_RATE_8000_192000, .formats = TAS2552_FORMATS, }, + .capture = { + .stream_name = "Capture", + .channels_min = 2, + .channels_max = 2, + .rates = SNDRV_PCM_RATE_8000_192000, + .formats = TAS2552_FORMATS, + }, .ops = &tas2552_speaker_dai_ops, }, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 407/473 NFSv4: Fixup smatch warning for ambiguous return
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Coddington <[email protected]>
[ Upstream commit 37ffe06537af3e3ec212e7cbe941046fce0a822f ]
Dan Carpenter reports smatch warning for nfs4_try_migration() when a memory allocation failure results in a zero return value. In this case, a transient allocation failure error will likely be retried the next time the server responds with NFS4ERR_MOVED.
We can fixup the smatch warning with a small refactor: attempt all three allocations before testing and returning on a failure.
--- fs/nfs/nfs4state.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
fs/nfs/nfs4state.c +5 -7
@@ -2113,6 +2113,7 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred {struct nfs_client *clp = server->nfs_client;struct nfs4_fs_locations *locations =NULL ; +struct nfs_fattr *fattr;struct inode *inode;struct page *page;int status, result;
@@ -2122,19 +2123,16 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred (unsigned long long )server->fsid.minor, clp->cl_hostname); - result =0 ; page =alloc_page (GFP_KERNEL ); locations =kmalloc (sizeof (struct nfs4_fs_locations ),GFP_KERNEL ); -if (page ==NULL || locations ==NULL ) { -dprintk ("<-- %s: no memory\n" , __func__); - goto out; - } - locations->fattr =nfs_alloc_fattr (); -if (locations->fattr ==NULL ) { + fattr =nfs_alloc_fattr (); +if (page ==NULL || locations ==NULL || fattr ==NULL ) {dprintk ("<-- %s: no memory\n" , __func__); + result =0 ; goto out; } + locations->fattr = fattr; inode =d_inode (server->super->s_root); result =nfs4_proc_get_locations (server,NFS_FH (inode), locations, page, cred);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 408/473 nfs: keep server info for remounts
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Kaiser <[email protected]>
[ Upstream commit b322bf9e983addedff0894c55e92d58f4d16d92a ]
With newer kernels that use fs_context for nfs mounts, remounts fail with -EINVAL.
$ mount -t nfs -o nolock 10.0.0.1:/tmp/test /mnt/test/ $ mount -t nfs -o remount /mnt/test/ mount: mounting 10.0.0.1:/tmp/test on /mnt/test failed: Invalid argument
For remounts, the nfs server address and port are populated by nfs_init_fs_context and later overwritten with 0x00 bytes by nfs23_parse_monolithic. The remount then fails as the server address is invalid.
Fix this by not overwriting nfs server info in nfs23_parse_monolithic if we're doing a remount.
--- fs/nfs/fs_context.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/nfs/fs_context.c +6 -3
@@ -1047,9 +1047,12 @@ static int nfs23_parse_monolithic(struct fs_context *fc, ctx->acdirmax = data->acdirmax; ctx->need_mount = false; -memcpy (sap, &data->addr,sizeof (data->addr)); - ctx->nfs_server.addrlen =sizeof (data->addr); - ctx->nfs_server.port =ntohs (data->addr.sin_port); +if (!is_remount_fc (fc)) { +memcpy (sap, &data->addr,sizeof (data->addr)); + ctx->nfs_server.addrlen =sizeof (data->addr); + ctx->nfs_server.port =ntohs (data->addr.sin_port); + } +if (sap->ss_family !=AF_INET || !nfs_verify_server_address (sap)) goto out_no_address;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 409/473 sunrpc: fix NFSACL RPC retry on soft mount
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Aloni <[email protected]>
[ Upstream commit 0dc9f430027b8bd9073fdafdfcdeb1a073ab5594 ]
It used to be quite awhile ago since 1b63a75180c6 ('SUNRPC: Refactor rpc_clone_client()'), in 2012, that cl_timeout was copied in so that all mount parameters propagate to NFSACL clients. However since that change, if mount options as follows are given:
soft,timeo=50,retrans=16,vers=3
The resultant NFSACL client receives:
cl_softrtry: 1
cl_timeout: to_initval=60000, to_maxval=60000, to_increment=0, to_retries=2, to_exponential=0These values lead to NFSACL operations not being retried under the condition of transient network outages with soft mount. Instead, getacl call fails after 60 seconds with EIO.
The simple fix is to pass the existing client's cl_timeout as the new client timeout.
--- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/clnt.c +1 -0
@@ -1047,6 +1047,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old, .authflavor = old->cl_auth->au_flavor, .cred = old->cl_cred, .stats = old->cl_stats, + .timeout = old->cl_timeout, };struct rpc_clnt *clnt;int err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 410/473 rpcrdma: fix handling for RDMA_CM_EVENT_DEVICE_REMOVAL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Aloni <[email protected]>
[ Upstream commit 4836da219781ec510c4c0303df901aa643507a7a ]
Under the scenario of IB device bonding, when bringing down one of the ports, or all ports, we saw xprtrdma entering a non-recoverable state where it is not even possible to complete the disconnect and shut it down the mount, requiring a reboot. Following debug, we saw that transport connect never ended after receiving the RDMA_CM_EVENT_DEVICE_REMOVAL callback.
The DEVICE_REMOVAL callback is irrespective of whether the CM_ID is connected, and ESTABLISHED may not have happened. So need to work with each of these states accordingly.
--- net/sunrpc/xprtrdma/verbs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/sunrpc/xprtrdma/verbs.c +5 -1
@@ -244,7 +244,11 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)case RDMA_CM_EVENT_DEVICE_REMOVAL :pr_info ("rpcrdma: removing device %s for %pISpc\n" , ep->re_id->device->name, sap); - fallthrough; +switch (xchg (&ep->re_connect_status, -ENODEV )) { +case 0 : goto wake_connect_worker; +case 1 : goto disconnected; + } +return 0 ;case RDMA_CM_EVENT_ADDR_CHANGE : ep->re_connect_status = -ENODEV ; goto disconnected;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 411/473 af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 9841991a446c87f90f66f4b9fee6fe934c1336a2 ]
Billy Jheng Bing-Jhong reported a race between __unix_gc() and queue_oob().
__unix_gc() tries to garbage-collect close()d inflight sockets, and then if the socket has MSG_OOB in unix_sk(sk)->oob_skb, GC will drop the reference and set NULL to it locklessly.
However, the peer socket still can send MSG_OOB message and queue_oob() can update unix_sk(sk)->oob_skb concurrently, leading NULL pointer dereference. [0]
To fix the issue, let's update unix_sk(sk)->oob_skb under the sk_receive_queue's lock and take it everywhere we touch oob_skb.
Note that we defer kfree_skb() in manage_oob() to silence lockdep false-positive (See [1]).
[0]:
BUG: kernel NULL pointer dereference, address: 0000000000000008 PF: supervisor write access in kernel mode PF: error_code(0x0002) - not-present page PGD 8000000009f5e067 P4D 8000000009f5e067 PUD 9f5d067 PMD 0 Oops: 0002 [#1] PREEMPT SMP PTI CPU: 3 PID: 50 Comm: kworker/3:1 Not tainted 6.9.0-rc5-00191-gd091e579b864 #110 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 Workqueue: events delayed_fput RIP: 0010:skb_dequeue (./include/linux/skbuff.h:2386 ./include/linux/skbuff.h:2402 net/core/skbuff.c:3847) Code: 39 e3 74 3e 8b 43 10 48 89 ef 83 e8 01 89 43 10 49 8b 44 24 08 49 c7 44 24 08 00 00 00 00 49 8b 14 24 49 c7 04 24 00 00 00 00 <48> 89 42 08 48 89 10 e8 e7 c5 42 00 4c 89 e0 5b 5d 41 5c c3 cc cc RSP: 0018:ffffc900001bfd48 EFLAGS: 00000002 RAX: 0000000000000000 RBX: ffff8880088f5ae8 RCX: 00000000361289f9 RDX: 0000000000000000 RSI: 0000000000000206 RDI: ffff8880088f5b00 RBP: ffff8880088f5b00 R08: 0000000000080000 R09: 0000000000000001 R10: 0000000000000003 R11: 0000000000000001 R12: ffff8880056b6a00 R13: ffff8880088f5280 R14: 0000000000000001 R15: ffff8880088f5a80 FS: 0000000000000000(0000) GS:ffff88807dd80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000008 CR3: 0000000006314000 CR4: 00000000007506f0 PKRU: 55555554 Call Trace: <TASK> unix_release_sock (net/unix/af_unix.c:654) unix_release (net/unix/af_unix.c:1050) __sock_release (net/socket.c:660) sock_close (net/socket.c:1423) __fput (fs/file_table.c:423) delayed_fput (fs/file_table.c:444 (discriminator 3)) process_one_work (kernel/workqueue.c:3259) worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416) kthread (kernel/kthread.c:388) ret_from_fork (arch/x86/kernel/process.c:153) ret_from_fork_asm (arch/x86/entry/entry_64.S:257) </TASK> Modules linked in:
CR2: 0000000000000008
--- net/unix/af_unix.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
net/unix/af_unix.c +22 -6
@@ -2137,13 +2137,15 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *othermaybe_add_creds (skb, sock, other);skb_get (skb); +scm_stat_add (other, skb); + +spin_lock (&other->sk_receive_queue.lock);if (ousk->oob_skb)consume_skb (ousk->oob_skb); -WRITE_ONCE (ousk->oob_skb, skb); +__skb_queue_tail (&other->sk_receive_queue, skb); +spin_unlock (&other->sk_receive_queue.lock); -scm_stat_add (other, skb); -skb_queue_tail (&other->sk_receive_queue, skb);sk_send_sigurg (other);unix_state_unlock (other); other->sk_data_ready (other);
@@ -2626,8 +2628,10 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)mutex_lock (&u->iolock);unix_state_lock (sk); +spin_lock (&sk->sk_receive_queue.lock);if (sock_flag (sk,SOCK_URGINLINE ) || !u->oob_skb) { +spin_unlock (&sk->sk_receive_queue.lock);unix_state_unlock (sk);mutex_unlock (&u->iolock);return -EINVAL ;
@@ -2639,6 +2643,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)WRITE_ONCE (u->oob_skb,NULL ); elseskb_get (oob_skb ); + +spin_unlock (&sk->sk_receive_queue.lock);unix_state_unlock (sk); chunk = state->recv_actor (oob_skb,0 , chunk, state);
@@ -2667,6 +2673,10 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,consume_skb (skb); skb =NULL ; }else { +struct sk_buff *unlinked_skb =NULL ; + +spin_lock (&sk->sk_receive_queue.lock); +if (skb == u->oob_skb) {if (copied) { skb =NULL ;
@@ -2678,13 +2688,19 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, }else if (flags &MSG_PEEK ) { skb =NULL ; }else { -skb_unlink (skb, &sk->sk_receive_queue); +__skb_unlink (skb, &sk->sk_receive_queue);WRITE_ONCE (u->oob_skb,NULL ); -if (!WARN_ON_ONCE (skb_unref (skb))) -kfree_skb (skb); + unlinked_skb = skb; skb =skb_peek (&sk->sk_receive_queue); } } + +spin_unlock (&sk->sk_receive_queue.lock); + +if (unlinked_skb) { +WARN_ON_ONCE (skb_unref (unlinked_skb)); +kfree_skb (unlinked_skb); + } }return skb; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 412/473 ipv6: sr: fix memleak in seg6_hmac_init_algo
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit efb9f4f19f8e37fde43dfecebc80292d179f56c6 ]
seg6_hmac_init_algo returns without cleaning up the previous allocations if one fails, so it's going to leak all that memory and the crypto tfms.
Update seg6_hmac_exit to only free the memory when allocated, so we can reuse the code directly.
--- net/ipv6/seg6_hmac.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-)
net/ipv6/seg6_hmac.c +28 -14
@@ -354,6 +354,7 @@ static int seg6_hmac_init_algo(void)struct crypto_shash *tfm;struct shash_desc *shash;int i, alg_count, cpu; +int ret = -ENOMEM ; alg_count =ARRAY_SIZE (hmac_algos);
@@ -364,12 +365,14 @@ static int seg6_hmac_init_algo(void) algo = &hmac_algos[i]; algo->tfms = alloc_percpu(struct crypto_shash *);if (!algo->tfms) -return -ENOMEM ; + goto error_out;for_each_possible_cpu (cpu) { tfm =crypto_alloc_shash (algo->name,0 ,0 ); -if (IS_ERR (tfm)) -return PTR_ERR (tfm); +if (IS_ERR (tfm)) { + ret =PTR_ERR (tfm); + goto error_out; + } p_tfm =per_cpu_ptr (algo->tfms, cpu); *p_tfm = tfm; }
@@ -381,18 +384,22 @@ static int seg6_hmac_init_algo(void) algo->shashs = alloc_percpu(struct shash_desc *);if (!algo->shashs) -return -ENOMEM ; + goto error_out;for_each_possible_cpu (cpu) { shash =kzalloc_node (shsize,GFP_KERNEL ,cpu_to_node (cpu));if (!shash) -return -ENOMEM ; + goto error_out; *per_cpu_ptr (algo->shashs, cpu) = shash; } }return 0 ; + +error_out: +seg6_hmac_exit (); +return ret; }int __init seg6_hmac_init (void )
@@ -410,22 +417,29 @@ int __net_init seg6_hmac_net_init(struct net *net)void seg6_hmac_exit (void ) {struct seg6_hmac_algo *algo =NULL ; +struct crypto_shash *tfm; +struct shash_desc *shash;int i, alg_count, cpu; alg_count =ARRAY_SIZE (hmac_algos);for (i =0 ; i < alg_count; i++) { algo = &hmac_algos[i]; -for_each_possible_cpu (cpu) { -struct crypto_shash *tfm; -struct shash_desc *shash; - shash = *per_cpu_ptr (algo->shashs, cpu); -kfree (shash); - tfm = *per_cpu_ptr (algo->tfms, cpu); -crypto_free_shash (tfm); +if (algo->shashs) { +for_each_possible_cpu (cpu) { + shash = *per_cpu_ptr (algo->shashs, cpu); +kfree (shash); + } +free_percpu (algo->shashs); + } + +if (algo->tfms) { +for_each_possible_cpu (cpu) { + tfm = *per_cpu_ptr (algo->tfms, cpu); +crypto_free_shash (tfm); + } +free_percpu (algo->tfms); } -free_percpu (algo->tfms); -free_percpu (algo->shashs); } }EXPORT_SYMBOL (seg6_hmac_exit);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 413/473 tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 3ebc46ca8675de6378e3f8f40768e180bb8afa66 ]
In dctcp_update_alpha(), we use a module parameter dctcp_shift_g as follows:
alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g); ... delivered_ce <<= (10 - dctcp_shift_g);
It seems syzkaller started fuzzing module parameters and triggered shift-out-of-bounds [0] by setting 100 to dctcp_shift_g:
memcpy((void*)0x20000080,
"/sys/module/tcp_dctcp/parameters/dctcp_shift_g\000", 47);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul,
/*flags=*/2ul, /*mode=*/0ul);
memcpy((void*)0x20000000, "100\000", 4);
syscall(__NR_write, /*fd=*/r[0], /*val=*/0x20000000ul, /*len=*/4ul);Let's limit the max value of dctcp_shift_g by param_set_uint_minmax().
With this patch:
# echo 10 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g # cat /sys/module/tcp_dctcp/parameters/dctcp_shift_g 10 # echo 11 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g -bash: echo: write error: Invalid argument
[0]:
UBSAN: shift-out-of-bounds in net/ipv4/tcp_dctcp.c:143:12 shift exponent 100 is too large for 32-bit type 'u32' (aka 'unsigned int') CPU: 0 PID: 8083 Comm: syz-executor345 Not tainted 6.9.0-05151-g1b294a1f3561 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x201/0x300 lib/dump_stack.c:114 ubsan_epilogue lib/ubsan.c:231 [inline] __ubsan_handle_shift_out_of_bounds+0x346/0x3a0 lib/ubsan.c:468 dctcp_update_alpha+0x540/0x570 net/ipv4/tcp_dctcp.c:143 tcp_in_ack_event net/ipv4/tcp_input.c:3802 [inline] tcp_ack+0x17b1/0x3bc0 net/ipv4/tcp_input.c:3948 tcp_rcv_state_process+0x57a/0x2290 net/ipv4/tcp_input.c:6711 tcp_v4_do_rcv+0x764/0xc40 net/ipv4/tcp_ipv4.c:1937 sk_backlog_rcv include/net/sock.h:1106 [inline] __release_sock+0x20f/0x350 net/core/sock.c:2983 release_sock+0x61/0x1f0 net/core/sock.c:3549 mptcp_subflow_shutdown+0x3d0/0x620 net/mptcp/protocol.c:2907 mptcp_check_send_data_fin+0x225/0x410 net/mptcp/protocol.c:2976 __mptcp_close+0x238/0xad0 net/mptcp/protocol.c:3072 mptcp_close+0x2a/0x1a0 net/mptcp/protocol.c:3127 inet_release+0x190/0x1f0 net/ipv4/af_inet.c:437 __sock_release net/socket.c:659 [inline] sock_close+0xc0/0x240 net/socket.c:1421 __fput+0x41b/0x890 fs/file_table.c:422 task_work_run+0x23b/0x300 kernel/task_work.c:180 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x9c8/0x2540 kernel/exit.c:878 do_group_exit+0x201/0x2b0 kernel/exit.c:1027 __do_sys_exit_group kernel/exit.c:1038 [inline] __se_sys_exit_group kernel/exit.c:1036 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1036 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xe4/0x240 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x67/0x6f RIP: 0033:0x7f6c2b5005b6 Code: Unable to access opcode bytes at 0x7f6c2b50058c. RSP: 002b:00007ffe883eb948 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007f6c2b5862f0 RCX: 00007f6c2b5005b6 RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001 RBP: 0000000000000001 R08: 00000000000000e7 R09: ffffffffffffffc0 R10: 0000000000000006 R11: 0000000000000246 R12: 00007f6c2b5862f0 R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001 </TASK>
--- net/ipv4/tcp_dctcp.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
net/ipv4/tcp_dctcp.c +12 -1
@@ -57,7 +57,18 @@ struct dctcp { };static unsigned int dctcp_shift_g__read_mostly =4 ;/* g = 1/2^4 */ -module_param (dctcp_shift_g, uint,0644 ); + +static int dctcp_shift_g_set (const char *val,const struct kernel_param *kp) +{ +return param_set_uint_minmax (val, kp,0 ,10 ); +} + +static const struct kernel_param_ops dctcp_shift_g_ops = { + .set = dctcp_shift_g_set, + .get = param_get_uint, +}; + +module_param_cb (dctcp_shift_g, &dctcp_shift_g_ops, &dctcp_shift_g,0644 );MODULE_PARM_DESC (dctcp_shift_g,"parameter g for updating dctcp_alpha" );static unsigned int dctcp_alpha_on_init__read_mostly =DCTCP_MAX_ALPHA ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 414/473 pNFS/filelayout: fixup pNfs allocation modes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Olga Kornievskaia <[email protected]>
[ Upstream commit 3ebcb24646f8c5bfad2866892d3f3cff05514452 ]
Change left over allocation flags.
--- fs/nfs/filelayout/filelayout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/filelayout/filelayout.c +2 -2
@@ -881,7 +881,7 @@ filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,NFS4_MAX_UINT64 ,IOMODE_READ , false, - GFP_KERNEL); + nfs_io_gfp_mask());if (IS_ERR (pgio->pg_lseg)) { pgio->pg_error =PTR_ERR (pgio->pg_lseg); pgio->pg_lseg =NULL ;
@@ -905,7 +905,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,NFS4_MAX_UINT64 ,IOMODE_RW , false, - GFP_NOFS); + nfs_io_gfp_mask());if (IS_ERR (pgio->pg_lseg)) { pgio->pg_error =PTR_ERR (pgio->pg_lseg); pgio->pg_lseg =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 415/473 openvswitch: Set the skbuff pkt_type for proper pmtud support.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Conole <[email protected]>
[ Upstream commit 30a92c9e3d6b073932762bef2ac66f4ee784c657 ]
Open vSwitch is originally intended to switch at layer 2, only dealing with Ethernet frames. With the introduction of l3 tunnels support, it crossed into the realm of needing to care a bit about some routing details when making forwarding decisions. If an oversized packet would need to be fragmented during this forwarding decision, there is a chance for pmtu to get involved and generate a routing exception. This is gated by the skbuff->pkt_type field.
When a flow is already loaded into the openvswitch module this field is set up and transitioned properly as a packet moves from one port to another. In the case that a packet execute is invoked after a flow is newly installed this field is not properly initialized. This causes the pmtud mechanism to omit sending the required exception messages across the tunnel boundary and a second attempt needs to be made to make sure that the routing exception is properly setup. To fix this, we set the outgoing packet's pkt_type to PACKET_OUTGOING, since it can only get to the openvswitch module via a port device or packet command.
Even for bridge ports as users, the pkt_type needs to be reset when doing the transmit as the packet is truly outgoing and routing needs to get involved post packet transformations, in the case of VXLAN/GENEVE/udp-tunnel packets. In general, the pkt_type on output gets ignored, since we go straight to the driver, but in the case of tunnel ports they go through IP routing layer.
This issue is periodically encountered in complex setups, such as large openshift deployments, where multiple sets of tunnel traversal occurs. A way to recreate this is with the ovn-heater project that can setup a networking environment which mimics such large deployments. We need larger environments for this because we need to ensure that flow misses occur. In these environment, without this patch, we can see:
./ovn_cluster.sh start
podman exec ovn-chassis-1 ip r a 170.168.0.5/32 dev eth1 mtu 1200 podman exec ovn-chassis-1 ip netns exec sw01p1 ip r flush cache podman exec ovn-chassis-1 ip netns exec sw01p1 \
ping 21.0.0.3 -M do -s 1300 -c2
PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data. From 21.0.0.3 icmp_seq=2 Frag needed and DF set (mtu = 1142)
--- 21.0.0.3 ping statistics ---
...
Using tcpdump, we can also see the expected ICMP FRAG_NEEDED message is not sent into the server.
With this patch, setting the pkt_type, we see the following:
podman exec ovn-chassis-1 ip netns exec sw01p1 \
ping 21.0.0.3 -M do -s 1300 -c2
PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data. From 21.0.0.3 icmp_seq=1 Frag needed and DF set (mtu = 1222)
ping: local error: message too long, mtu=1222
--- 21.0.0.3 ping statistics ---
...
In this case, the first ping request receives the FRAG_NEEDED message and a local routing exception is created.
Reported-at: https://issues.redhat.com/browse/FDP-164
--- net/openvswitch/actions.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/openvswitch/actions.c +6 -0
@@ -924,6 +924,12 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,pskb_trim (skb,ovs_mac_header_len (key)); } +/* Need to set the pkt_type to involve the routing layer. The +* packet movement through the OVS datapath doesn't generally +* use routing, but this is needed for tunnel cases. +*/ + skb->pkt_type =PACKET_OUTGOING ; +if (likely (!mru || (skb->len <= mru + vport->dev->hard_header_len))) {ovs_vport_send (vport, skb,ovs_key_mac_proto (key));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 416/473 arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiangfeng Xiao <[email protected]>
[ Upstream commit ffbf4fb9b5c12ff878a10ea17997147ea4ebea6f ]
When CONFIG_DEBUG_BUGVERBOSE=n, we fail to add necessary padding bytes to bug_table entries, and as a result the last entry in a bug table will be ignored, potentially leading to an unexpected panic(). All prior entries in the table will be handled correctly.
The arm64 ABI requires that struct fields of up to 8 bytes are naturally-aligned, with padding added within a struct such that struct are suitably aligned within arrays.
When CONFIG_DEBUG_BUGVERPOSE=y, the layout of a bug_entry is:
struct bug_entry {
signed int bug_addr_disp; // 4 bytes
signed int file_disp; // 4 bytes
unsigned short line; // 2 bytes
unsigned short flags; // 2 bytes
}
... with 12 bytes total, requiring 4-byte alignment.
When CONFIG_DEBUG_BUGVERBOSE=n, the layout of a bug_entry is:
struct bug_entry {
signed int bug_addr_disp; // 4 bytes
unsigned short flags; // 2 bytes
< implicit padding > // 2 bytes
}
... with 8 bytes total, with 6 bytes of data and 2 bytes of trailing padding, requiring 4-byte alginment.
When we create a bug_entry in assembly, we align the start of the entry to 4 bytes, which implicitly handles padding for any prior entries. However, we do not align the end of the entry, and so when CONFIG_DEBUG_BUGVERBOSE=n, the final entry lacks the trailing padding bytes.
For the main kernel image this is not a problem as find_bug() doesn't depend on the trailing padding bytes when searching for entries:
for (bug = __start___bug_table; bug < __stop___bug_table; ++bug) if (bugaddr == bug_addr(bug)) return bug;
However for modules, module_bug_finalize() depends on the trailing bytes when calculating the number of entries:
mod->num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
... and as the last bug_entry lacks the necessary padding bytes, this entry will not be counted, e.g. in the case of a single entry:
sechdrs[i].sh_size == 6 sizeof(struct bug_entry) == 8; sechdrs[i].sh_size / sizeof(struct bug_entry) == 0;
Consequently module_find_bug() will miss the last bug_entry when it does:
for (i = 0; i < mod->num_bugs; ++i, ++bug) if (bugaddr == bug_addr(bug)) goto out;
... which can lead to a kenrel panic due to an unhandled bug.
This can be demonstrated with the following module:
static int __init buginit(void)
{
WARN(1, "hello\n");
return 0;
}
static void __exit bugexit(void)
{
}
module_init(buginit);
module_exit(bugexit);
MODULE_LICENSE("GPL");... which will trigger a kernel panic when loaded:
------------[ cut here ]------------ hello Unexpected kernel BRK exception at EL1 Internal error: BRK handler: 00000000f2000800 [#1] PREEMPT SMP Modules linked in: hello(O+) CPU: 0 PID: 50 Comm: insmod Tainted: G O 6.9.1 #8 Hardware name: linux,dummy-virt (DT) pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : buginit+0x18/0x1000 [hello] lr : buginit+0x18/0x1000 [hello] sp : ffff800080533ae0 x29: ffff800080533ae0 x28: 0000000000000000 x27: 0000000000000000 x26: ffffaba8c4e70510 x25: ffff800080533c30 x24: ffffaba8c4a28a58 x23: 0000000000000000 x22: 0000000000000000 x21: ffff3947c0eab3c0 x20: ffffaba8c4e3f000 x19: ffffaba846464000 x18: 0000000000000006 x17: 0000000000000000 x16: ffffaba8c2492834 x15: 0720072007200720 x14: 0720072007200720 x13: ffffaba8c49b27c8 x12: 0000000000000312 x11: 0000000000000106 x10: ffffaba8c4a0a7c8 x9 : ffffaba8c49b27c8 x8 : 00000000ffffefff x7 : ffffaba8c4a0a7c8 x6 : 80000000fffff000 x5 : 0000000000000107 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff3947c0eab3c0 Call trace: buginit+0x18/0x1000 [hello] do_one_initcall+0x80/0x1c8 do_init_module+0x60/0x218 load_module+0x1ba4/0x1d70 __do_sys_init_module+0x198/0x1d0 __arm64_sys_init_module+0x1c/0x28 invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0x40/0xe0 do_el0_svc+0x1c/0x28 el0_svc+0x34/0xd8 el0t_64_sync_handler+0x120/0x12c el0t_64_sync+0x190/0x194 Code: d0ffffe0 910003fd 91000000 9400000b (d4210000) ---[ end trace 0000000000000000 ]--- Kernel panic - not syncing: BRK handler: Fatal exception
Fix this by always aligning the end of a bug_entry to 4 bytes, which is correct regardless of CONFIG_DEBUG_BUGVERBOSE.
--- arch/arm64/include/asm/asm-bug.h | 1 + 1 file changed, 1 insertion(+)
arch/arm64/include/asm/asm-bug.h +1 -0
@@ -28,6 +28,7 @@ 14470: .long 14471f - .; \_BUGVERBOSE_LOCATION (__FILE__, __LINE__) \ .short flags; \ + .align 2; \ .popsection; \ 14471:#else
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 417/473 Update rv_en(dis)able_monitor doc to match kernel-doc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Li <[email protected]>
[ Upstream commit 1e8b7b3dbb3103d577a586ca72bc329f7b67120b ]
The patch updates the function documentation comment for rv_en(dis)able_monitor to adhere to the kernel-doc specification.
--- kernel/trace/rv/rv.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/trace/rv/rv.c +2 -0
@@ -245,6 +245,7 @@ static int __rv_disable_monitor(struct rv_monitor_def *mdef, bool sync)/** * rv_disable_monitor - disable a given runtime monitor +* @mdef: Pointer to the monitor definition structure. * * Returns 0 on success. */
@@ -256,6 +257,7 @@ int rv_disable_monitor(struct rv_monitor_def *mdef)/** * rv_enable_monitor - enable a given runtime monitor +* @mdef: Pointer to the monitor definition structure. * * Returns 0 on success, error otherwise. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 418/473 virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Pirko <[email protected]>
[ Upstream commit 89875151fccdd024d571aa884ea97a0128b968b6 ]
When request_irq() fails, error path calls vp_del_vqs(). There, as vq is present in the list, free_irq() is called for the same vector. That causes following splat:
[ 0.414355] Trying to free already-free IRQ 27 [ 0.414403] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:1899 free_irq+0x1a1/0x2d0 [ 0.414510] Modules linked in: [ 0.414540] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc4+ #27 [ 0.414540] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014 [ 0.414540] RIP: 0010:free_irq+0x1a1/0x2d0 [ 0.414540] Code: 1e 00 48 83 c4 08 48 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 90 8b 74 24 04 48 c7 c7 98 80 6c b1 e8 00 c9 f7 ff 90 <0f> 0b 90 90 48 89 ee 4c 89 ef e8 e0 20 b8 00 49 8b 47 40 48 8b 40 [ 0.414540] RSP: 0000:ffffb71480013ae0 EFLAGS: 00010086 [ 0.414540] RAX: 0000000000000000 RBX: ffffa099c2722000 RCX: 0000000000000000 [ 0.414540] RDX: 0000000000000000 RSI: ffffb71480013998 RDI: 0000000000000001 [ 0.414540] RBP: 0000000000000246 R08: 00000000ffffdfff R09: 0000000000000001 [ 0.414540] R10: 00000000ffffdfff R11: ffffffffb18729c0 R12: ffffa099c1c91760 [ 0.414540] R13: ffffa099c1c916a4 R14: ffffa099c1d2f200 R15: ffffa099c1c91600 [ 0.414540] FS: 0000000000000000(0000) GS:ffffa099fec40000(0000) knlGS:0000000000000000 [ 0.414540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 0.414540] CR2: 0000000000000000 CR3: 0000000008e3e001 CR4: 0000000000370ef0 [ 0.414540] Call Trace: [ 0.414540] <TASK> [ 0.414540] ? __warn+0x80/0x120 [ 0.414540] ? free_irq+0x1a1/0x2d0 [ 0.414540] ? report_bug+0x164/0x190 [ 0.414540] ? handle_bug+0x3b/0x70 [ 0.414540] ? exc_invalid_op+0x17/0x70 [ 0.414540] ? asm_exc_invalid_op+0x1a/0x20 [ 0.414540] ? free_irq+0x1a1/0x2d0 [ 0.414540] vp_del_vqs+0xc1/0x220 [ 0.414540] vp_find_vqs_msix+0x305/0x470 [ 0.414540] vp_find_vqs+0x3e/0x1a0 [ 0.414540] vp_modern_find_vqs+0x1b/0x70 [ 0.414540] init_vqs+0x387/0x600 [ 0.414540] virtnet_probe+0x50a/0xc80 [ 0.414540] virtio_dev_probe+0x1e0/0x2b0 [ 0.414540] really_probe+0xc0/0x2c0 [ 0.414540] ? __pfx___driver_attach+0x10/0x10 [ 0.414540] __driver_probe_device+0x73/0x120 [ 0.414540] driver_probe_device+0x1f/0xe0 [ 0.414540] __driver_attach+0x88/0x180 [ 0.414540] bus_for_each_dev+0x85/0xd0 [ 0.414540] bus_add_driver+0xec/0x1f0 [ 0.414540] driver_register+0x59/0x100 [ 0.414540] ? __pfx_virtio_net_driver_init+0x10/0x10 [ 0.414540] virtio_net_driver_init+0x90/0xb0 [ 0.414540] do_one_initcall+0x58/0x230 [ 0.414540] kernel_init_freeable+0x1a3/0x2d0 [ 0.414540] ? __pfx_kernel_init+0x10/0x10 [ 0.414540] kernel_init+0x1a/0x1c0 [ 0.414540] ret_from_fork+0x31/0x50 [ 0.414540] ? __pfx_kernel_init+0x10/0x10 [ 0.414540] ret_from_fork_asm+0x1a/0x30 [ 0.414540] </TASK>
Fix this by calling deleting the current vq when request_irq() fails.
Message-Id: <[email protected]>
--- drivers/virtio/virtio_pci_common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/virtio/virtio_pci_common.c +3 -1
@@ -345,8 +345,10 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs, vring_interrupt,0 , vp_dev->msix_names[msix_vec], vqs[i]); -if (err) +if (err) { +vp_del_vq (vqs[i]); goto error_find; + } }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 419/473 riscv: stacktrace: Make walk_stackframe cross pt_regs frame
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guo Ren <[email protected]>
[ Upstream commit 7ecdadf7f8c659524f6b2aebf6be7bf619764d90 ]
The current walk_stackframe with FRAME_POINTER would stop unwinding at ret_from_exception:
BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1518 in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: init CPU: 0 PID: 1 Comm: init Not tainted 5.10.113-00021-g15c15974895c-dirty #192 Call Trace: [<ffffffe0002038c8>] walk_stackframe+0x0/0xee [<ffffffe000aecf48>] show_stack+0x32/0x4a [<ffffffe000af1618>] dump_stack_lvl+0x72/0x8e [<ffffffe000af1648>] dump_stack+0x14/0x1c [<ffffffe000239ad2>] ___might_sleep+0x12e/0x138 [<ffffffe000239aec>] __might_sleep+0x10/0x18 [<ffffffe000afe3fe>] down_read+0x22/0xa4 [<ffffffe000207588>] do_page_fault+0xb0/0x2fe [<ffffffe000201b80>] ret_from_exception+0x0/0xc
The optimization would help walk_stackframe cross the pt_regs frame and get more backtrace of debug info:
BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1518 in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: init CPU: 0 PID: 1 Comm: init Not tainted 5.10.113-00021-g15c15974895c-dirty #192 Call Trace: [<ffffffe0002038c8>] walk_stackframe+0x0/0xee [<ffffffe000aecf48>] show_stack+0x32/0x4a [<ffffffe000af1618>] dump_stack_lvl+0x72/0x8e [<ffffffe000af1648>] dump_stack+0x14/0x1c [<ffffffe000239ad2>] ___might_sleep+0x12e/0x138 [<ffffffe000239aec>] __might_sleep+0x10/0x18 [<ffffffe000afe3fe>] down_read+0x22/0xa4 [<ffffffe000207588>] do_page_fault+0xb0/0x2fe [<ffffffe000201b80>] ret_from_exception+0x0/0xc [<ffffffe000613c06>] riscv_intc_irq+0x1a/0x72 [<ffffffe000201b80>] ret_from_exception+0x0/0xc [<ffffffe00033f44a>] vma_link+0x54/0x160 [<ffffffe000341d7a>] mmap_region+0x2cc/0x4d0 [<ffffffe000342256>] do_mmap+0x2d8/0x3ac [<ffffffe000326318>] vm_mmap_pgoff+0x70/0xb8 [<ffffffe00032638a>] vm_mmap+0x2a/0x36 [<ffffffe0003cfdde>] elf_map+0x72/0x84 [<ffffffe0003d05f8>] load_elf_binary+0x69a/0xec8 [<ffffffe000376240>] bprm_execve+0x246/0x53a [<ffffffe00037786c>] kernel_execve+0xe8/0x124 [<ffffffe000aecdf2>] run_init_process+0xfa/0x10c [<ffffffe000aece16>] try_to_run_init_process+0x12/0x3c [<ffffffe000afa920>] kernel_init+0xb4/0xf8 [<ffffffe000201b80>] ret_from_exception+0x0/0xc
Here is the error injection test code for the above output:
drivers/irqchip/irq-riscv-intc.c:
static asmlinkage void riscv_intc_irq(struct pt_regs *regs)
{
unsigned long cause = regs->cause & ~CAUSE_IRQ_FLAG;+ u32 tmp; __get_user(tmp, (u32 *)0);
Stable-dep-of: a2a4d4a6a0bf ("riscv: stacktrace: fixed walk_stackframe()")
--- arch/riscv/kernel/entry.S | 3 ++- arch/riscv/kernel/stacktrace.c | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
arch/riscv/kernel/entry.S +2 -1
@@ -248,7 +248,7 @@ ret_from_syscall_rejected: andi t0, t0, _TIF_SYSCALL_WORK bnez t0, handle_syscall_trace_exit -ret_from_exception: +SYM_CODE_START_NOALIGN(ret_from_exception) REG_L s0, PT_STATUS(sp) csrc CSR_STATUS, SR_IE #ifdef CONFIG_TRACE_IRQFLAGS
@@ -262,6 +262,7 @@ ret_from_exception: andi s0, s0, SR_SPP #endif bnez s0, resume_kernel +SYM_CODE_END(ret_from_exception) /* Interrupts must be disabled here so flags are checked atomically */ REG_L s0, TASK_TI_FLAGS(tp) /* current_thread_info->flags */
arch/riscv/kernel/stacktrace.c +9 -0
@@ -16,6 +16,8 @@#ifdef CONFIG_FRAME_POINTER +extern asmlinkage void ret_from_exception(void); + void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,bool (*fn)(void *,unsigned long ),void *arg) {
@@ -60,6 +62,13 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, fp = frame->fp; pc =ftrace_graph_ret_addr (current,NULL , frame->ra, &frame->ra); +if (pc == (unsigned long )ret_from_exception) { +if (unlikely (!__kernel_text_address (pc) || !fn (arg, pc))) +break ; + + pc = ((struct pt_regs *)sp)->epc; + fp = ((struct pt_regs *)sp)->s0; + } } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 420/473 riscv: stacktrace: fixed walk_stackframe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Bystrin <[email protected]>
[ Upstream commit a2a4d4a6a0bf5eba66f8b0b32502cc20d82715a0 ]
If the load access fault occures in a leaf function (with CONFIG_FRAME_POINTER=y), when wrong stack trace will be displayed:
[<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c ---[ end trace 0000000000000000 ]---
Registers dump:
ra 0xffffffff80485758 <regmap_mmio_read+36>
sp 0xffffffc80200b9a0
fp 0xffffffc80200b9b0
pc 0xffffffff804853ba <regmap_mmio_read32le+6>Stack dump:
0xffffffc80200b9a0: 0xffffffc80200b9e0 0xffffffc80200b9e0
0xffffffc80200b9b0: 0xffffffff8116d7e8 0x0000000000000100
0xffffffc80200b9c0: 0xffffffd8055b9400 0xffffffd8055b9400
0xffffffc80200b9d0: 0xffffffc80200b9f0 0xffffffff8047c526
0xffffffc80200b9e0: 0xffffffc80200ba30 0xffffffff8047fe9aThe assembler dump of the function preambula:
add sp,sp,-16
sd s0,8(sp)
add s0,sp,16In the fist stack frame, where ra is not stored on the stack we can observe:
0(sp) 8(sp)
.---------------------------------------------.
sp->| frame->fp | frame->ra (saved fp) |
|---------------------------------------------|
fp->| .... | .... |
|---------------------------------------------|
| | |and in the code check is performed:
if (regs && (regs->epc == pc) && (frame->fp & 0x7))
I see no reason to check frame->fp value at all, because it is can be uninitialized value on the stack. A better way is to check frame->ra to be an address on the stack. After the stacktrace shows as expect:
[<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c [<ffffffff80485758>] regmap_mmio_read+0x24/0x52 [<ffffffff8047c526>] _regmap_bus_reg_read+0x1a/0x22 [<ffffffff8047fe9a>] _regmap_read+0x5c/0xea [<ffffffff80480376>] _regmap_update_bits+0x76/0xc0 ... ---[ end trace 0000000000000000 ]---
As pointed by Samuel Holland it is incorrect to remove check of the stackframe entirely.
Changes since v2 [2]:
- Add accidentally forgotten curly brace
Changes since v1 [1]:
- Instead of just dropping frame->fp check, replace it with validation of frame->ra, which should be a stack address.
- Move frame pointer validation into the separate function.
[1] https://lore.kernel.org/linux-riscv/[email protected]/
[2] https://lore.kernel.org/linux-riscv/[email protected]/
--- arch/riscv/kernel/stacktrace.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
arch/riscv/kernel/stacktrace.c +14 -6
@@ -18,6 +18,16 @@ extern asmlinkage void ret_from_exception(void); +static inline int fp_is_valid (unsigned long fp,unsigned long sp) +{ +unsigned long low, high; + + low = sp +sizeof (struct stackframe ); + high =ALIGN (sp,THREAD_SIZE ); + +return !(fp < low || fp > high || fp &0x07 ); +} + void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,bool (*fn)(void *,unsigned long ),void *arg) {
@@ -41,21 +51,19 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, }for (;;) { -unsigned long low, high;struct stackframe *frame;if (unlikely (!__kernel_text_address (pc) || (level++ >=0 && !fn (arg, pc))))break ; -/* Validate frame pointer */ - low = sp +sizeof (struct stackframe ); - high =ALIGN (sp,THREAD_SIZE ); -if (unlikely (fp < low || fp > high || fp &0x7 )) +if (unlikely (!fp_is_valid (fp, sp)))break ; +/* Unwind stack frame */ frame = (struct stackframe *)fp -1 ; sp = fp; -if (regs && (regs->epc == pc) && (frame->fp &0x7 )) { +if (regs && (regs->epc == pc) &&fp_is_valid (frame->ra, sp)) { +/* We hit function where ra is not saved on the stack */ fp = frame->ra; pc = regs->ra; }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 421/473 Revert "ixgbe: Manual AN-37 for troublesome link partners for X550 SFI"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Keller <[email protected]>
[ Upstream commit b35b1c0b4e166a427395deaf61e3140495dfcb89 ]
This reverts commit 565736048bd5f9888990569993c6b6bfdf6dcb6d.
According to the commit, it implements a manual AN-37 for some "troublesome" Juniper MX5 switches. This appears to be a workaround for a particular switch.
It has been reported that this causes a severe breakage for other switches, including a Cisco 3560CX-12PD-S.
The code appears to be a workaround for a specific switch which fails to link in SFI mode. It expects to see AN-37 auto negotiation in order to link. The Cisco switch is not expecting AN-37 auto negotiation. When the device starts the manual AN-37, the Cisco switch decides that the port is confused and stops attempting to link with it. This persists until a power cycle. A simple driver unload and reload does not resolve the issue, even if loading with a version of the driver which lacks this workaround.
The authors of the workaround commit have not responded with clarifications, and the result of the workaround is complete failure to connect with other switches.
This appears to be a case where the driver can either "correctly" link with the Juniper MX5 switch, at the cost of bricking the link with the Cisco switch, or it can behave properly for the Cisco switch, but fail to link with the Junipir MX5 switch. I do not know enough about the standards involved to clearly determine whether either switch is at fault or behaving incorrectly. Nor do I know whether there exists some alternative fix which corrects behavior with both switches.
Revert the workaround for the Juniper switch.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 3 - drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 56 +------------------ 2 files changed, 3 insertions(+), 56 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +0 -3
@@ -3673,9 +3673,7 @@ struct ixgbe_info {#define IXGBE_KRM_LINK_S1 (P ) ((P) ? 0x8200 : 0x4200)#define IXGBE_KRM_LINK_CTRL_1 (P ) ((P) ? 0x820C : 0x420C)#define IXGBE_KRM_AN_CNTL_1 (P ) ((P) ? 0x822C : 0x422C) -#define IXGBE_KRM_AN_CNTL_4 (P ) ((P) ? 0x8238 : 0x4238)#define IXGBE_KRM_AN_CNTL_8 (P ) ((P) ? 0x8248 : 0x4248) -#define IXGBE_KRM_PCS_KX_AN (P ) ((P) ? 0x9918 : 0x5918)#define IXGBE_KRM_SGMII_CTRL (P ) ((P) ? 0x82A0 : 0x42A0)#define IXGBE_KRM_LP_BASE_PAGE_HIGH (P ) ((P) ? 0x836C : 0x436C)#define IXGBE_KRM_DSP_TXFFE_STATE_4 (P ) ((P) ? 0x8634 : 0x4634)
@@ -3685,7 +3683,6 @@ struct ixgbe_info {#define IXGBE_KRM_PMD_FLX_MASK_ST20 (P ) ((P) ? 0x9054 : 0x5054)#define IXGBE_KRM_TX_COEFF_CTRL_1 (P ) ((P) ? 0x9520 : 0x5520)#define IXGBE_KRM_RX_ANA_CTL (P ) ((P) ? 0x9A00 : 0x5A00) -#define IXGBE_KRM_FLX_TMRS_CTRL_ST31 (P ) ((P) ? 0x9180 : 0x5180)#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA ~(0x3 << 20)#define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR BIT(20)
drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c +3 -53
62 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 422/473 net: fec: avoid lock evasion when reading pps_enable
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit 3b1c92f8e5371700fada307cc8fd2c51fa7bc8c1 ]
The assignment of pps_enable is protected by tmreg_lock, but the read operation of pps_enable is not. So the Coverity tool reports a lock evasion warning which may cause data race to occur when running in a multithread environment. Although this issue is almost impossible to occur, we'd better fix it, at least it seems more logically reasonable, and it also prevents Coverity from continuing to issue warnings.
--- drivers/net/ethernet/freescale/fec_ptp.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +8 -6
@@ -102,14 +102,13 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)struct timespec64 ts;u64 ns; -if (fep->pps_enable == enable) -return 0 ; - - fep->pps_channel =DEFAULT_PPS_CHANNEL ; - fep->reload_period =PPS_OUPUT_RELOAD_PERIOD ; -spin_lock_irqsave (&fep->tmreg_lock, flags); +if (fep->pps_enable == enable) { +spin_unlock_irqrestore (&fep->tmreg_lock, flags); +return 0 ; + } +if (enable) {/* clear capture or output compare interrupt status if have. */
@@ -440,6 +439,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,int ret =0 ;if (rq->type ==PTP_CLK_REQ_PPS ) { + fep->pps_channel =DEFAULT_PPS_CHANNEL ; + fep->reload_period =PPS_OUPUT_RELOAD_PERIOD ; + ret =fec_ptp_enable_pps (fep, on);return ret;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 423/473 tls: fix missing memory barrier in tls_init
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dae R. Jeong <[email protected]>
[ Upstream commit 91e61dd7a0af660408e87372d8330ceb218be302 ]
In tls_init(), a write memory barrier is missing, and store-store reordering may cause NULL dereference in tls_{setsockopt,getsockopt}.
CPU0 CPU1
----- -----
// In tls_init()
// In tls_ctx_create()
ctx = kzalloc()ctx->sk_proto = READ_ONCE(sk->sk_prot) -(1)
// In update_sk_prot()WRITE_ONCE(sk->sk_prot, tls_prots) -(2)
// In sock_common_setsockopt()
READ_ONCE(sk->sk_prot)->setsockopt()
// In tls_{setsockopt,getsockopt}()
ctx->sk_proto->setsockopt() -(3)In the above scenario, when (1) and (2) are reordered, (3) can observe the NULL value of ctx->sk_proto, causing NULL dereference.
To fix it, we rely on rcu_assign_pointer() which implies the release barrier semantic. By moving rcu_assign_pointer() after ctx->sk_proto is initialized, we can ensure that ctx->sk_proto are visible when changing sk->sk_prot.
--- net/tls/tls_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
net/tls/tls_main.c +9 -1
@@ -910,9 +910,17 @@ struct tls_context *tls_ctx_create(struct sock *sk)return NULL ;mutex_init (&ctx->tx_lock); -rcu_assign_pointer (icsk->icsk_ulp_data, ctx); ctx->sk_proto =READ_ONCE (sk->sk_prot); ctx->sk = sk; +/* Release semantic of rcu_assign_pointer() ensures that +* ctx->sk_proto is visible before changing sk->sk_prot in +* update_sk_prot(), and prevents reading uninitialized value in +* tls_{getsockopt, setsockopt}. Note that we do not need a +* read barrier in tls_{getsockopt,setsockopt} as there is an +* address dependency between sk->sk_proto->{getsockopt,setsockopt} +* and ctx->sk_proto. +*/ +rcu_assign_pointer (icsk->icsk_ulp_data, ctx);return ctx; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 424/473 tcp: remove 64 KByte limit for initial tp->rcv_wnd value
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Xing <[email protected]>
[ Upstream commit 378979e94e953c2070acb4f0e0c98d29260bd09d ]
Recently, we had some servers upgraded to the latest kernel and noticed the indicator from the user side showed worse results than before. It is caused by the limitation of tp->rcv_wnd.
In 2018 commit a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB") limited the initial value of tp->rcv_wnd to 65535, most CDN teams would not benefit from this change because they cannot have a large window to receive a big packet, which will be slowed down especially in long RTT. Small rcv_wnd means slow transfer speed, to some extent. It's the side effect for the latency/time-sensitive users.
To avoid future confusion, current change doesn't affect the initial receive window on the wire in a SYN or SYN+ACK packet which are set within 65535 bytes according to RFC 7323 also due to the limit in __tcp_transmit_skb():
th->window = htons(min(tp->rcv_wnd, 65535U));
In one word, __tcp_transmit_skb() already ensures that constraint is respected, no matter how large tp->rcv_wnd is. The change doesn't violate RFC.
Let me provide one example if with or without the patch:
Before:
client --- SYN: rwindow=65535 ---> server client <--- SYN+ACK: rwindow=65535 ---- server client --- ACK: rwindow=65536 ---> server
Note: for the last ACK, the calculation is 512 << 7.
After:
client --- SYN: rwindow=65535 ---> server client <--- SYN+ACK: rwindow=65535 ---- server client --- ACK: rwindow=175232 ---> server
Note: I use the following command to make it work:
ip route change default via [ip] dev eth0 metric 100 initrwnd 120 For the last ACK, the calculation is 1369 << 7.
When we apply such a patch, having a large rcv_wnd if the user tweak this knob can help transfer data more rapidly and save some rtts.
--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
@@ -229,7 +229,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,if (READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_workaround_signed_windows)) (*rcv_wnd) =min (space,MAX_TCP_WINDOW );else - (*rcv_wnd) =min_t (u32, space,U16_MAX ); + (*rcv_wnd) = space;if (init_rcv_wnd) *rcv_wnd =min (*rcv_wnd, init_rcv_wnd * mss);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 425/473 inet: factor out locked section of inet_accept() in a new helper
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 711bdd5141d81ab21dbe0a533024d594210d5ba4 ]
No functional changes intended. The new helper will be used by the MPTCP protocol in the next patch to avoid duplicating a few LoC.
Stable-dep-of: 26afda78cda3 ("net: relax socket state check at accept time.")
--- include/net/inet_common.h | 2 ++ net/ipv4/af_inet.c | 32 +++++++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-)
include/net/inet_common.h +2 -0
@@ -31,6 +31,8 @@ int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags);int inet_accept (struct socket *sock,struct socket *newsock,int flags,bool kern); +void __inet_accept (struct socket *sock,struct socket *newsock, +struct sock *newsk);int inet_send_prepare (struct sock *sk);int inet_sendmsg (struct socket *sock,struct msghdr *msg,size_t size);void inet_splice_eof (struct socket *sock);
net/ipv4/af_inet.c +17 -15
@@ -744,6 +744,20 @@ int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, }EXPORT_SYMBOL (inet_stream_connect); +void __inet_accept (struct socket *sock,struct socket *newsock,struct sock *newsk) +{ +sock_rps_record_flow (newsk); +WARN_ON (!((1 << newsk->sk_state) & + (TCPF_ESTABLISHED |TCPF_SYN_RECV | +TCPF_CLOSE_WAIT |TCPF_CLOSE ))); + +if (test_bit (SOCK_SUPPORT_ZC , &sock->flags)) +set_bit (SOCK_SUPPORT_ZC , &newsock->flags); +sock_graft (newsk, newsock); + + newsock->state =SS_CONNECTED ; +} +/* * Accept a pending connection. The TCP layer now gives BSD semantics. */
@@ -757,24 +771,12 @@ int inet_accept(struct socket *sock, struct socket *newsock, int flags,/* IPV6_ADDRFORM can change sk->sk_prot under us. */ sk2 =READ_ONCE (sk1->sk_prot)->accept (sk1, flags, &err, kern);if (!sk2) - goto do_err; +return err;lock_sock (sk2); - -sock_rps_record_flow (sk2); -WARN_ON (!((1 << sk2->sk_state) & - (TCPF_ESTABLISHED |TCPF_SYN_RECV | -TCPF_CLOSE_WAIT |TCPF_CLOSE ))); - -if (test_bit (SOCK_SUPPORT_ZC , &sock->flags)) -set_bit (SOCK_SUPPORT_ZC , &newsock->flags); -sock_graft (sk2, newsock); - - newsock->state =SS_CONNECTED ; - err =0 ; +__inet_accept (sock, newsock, sk2);release_sock (sk2); -do_err: -return err; +return 0 ; }EXPORT_SYMBOL (inet_accept);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 426/473 net: relax socket state check at accept time.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 26afda78cda3da974fd4c287962c169e9462c495 ]
Christoph reported the following splat:
WARNING: CPU: 1 PID: 772 at net/ipv4/af_inet.c:761 __inet_accept+0x1f4/0x4a0 Modules linked in: CPU: 1 PID: 772 Comm: syz-executor510 Not tainted 6.9.0-rc7-g7da7119fe22b #56 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014 RIP: 0010:__inet_accept+0x1f4/0x4a0 net/ipv4/af_inet.c:759 Code: 04 38 84 c0 0f 85 87 00 00 00 41 c7 04 24 03 00 00 00 48 83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ec b7 da fd <0f> 0b e9 7f fe ff ff e8 e0 b7 da fd 0f 0b e9 fe fe ff ff 89 d9 80 RSP: 0018:ffffc90000c2fc58 EFLAGS: 00010293 RAX: ffffffff836bdd14 RBX: 0000000000000000 RCX: ffff888104668000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: dffffc0000000000 R08: ffffffff836bdb89 R09: fffff52000185f64 R10: dffffc0000000000 R11: fffff52000185f64 R12: dffffc0000000000 R13: 1ffff92000185f98 R14: ffff88810754d880 R15: ffff8881007b7800 FS: 000000001c772880(0000) GS:ffff88811b280000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fb9fcf2e178 CR3: 00000001045d2002 CR4: 0000000000770ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: <TASK> inet_accept+0x138/0x1d0 net/ipv4/af_inet.c:786 do_accept+0x435/0x620 net/socket.c:1929 __sys_accept4_file net/socket.c:1969 [inline] __sys_accept4+0x9b/0x110 net/socket.c:1999 __do_sys_accept net/socket.c:2016 [inline] __se_sys_accept net/socket.c:2013 [inline] __x64_sys_accept+0x7d/0x90 net/socket.c:2013 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x58/0x100 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x4315f9 Code: fd ff 48 81 c4 80 00 00 00 e9 f1 fe ff ff 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 ab b4 fd ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007ffdb26d9c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002b RAX: ffffffffffffffda RBX: 0000000000400300 RCX: 00000000004315f9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004 RBP: 00000000006e1018 R08: 0000000000400300 R09: 0000000000400300 R10: 0000000000400300 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000040cdf0 R14: 000000000040ce80 R15: 0000000000000055 </TASK>
The reproducer invokes shutdown() before entering the listener status. After commit 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets"), the above causes the child to reach the accept syscall in FIN_WAIT1 status.
Eric noted we can relax the existing assertion in __inet_accept()
--- net/ipv4/af_inet.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/af_inet.c +3 -1
@@ -749,7 +749,9 @@ void __inet_accept(struct socket *sock, struct socket *newsock, struct sock *newsock_rps_record_flow (newsk);WARN_ON (!((1 << newsk->sk_state) & (TCPF_ESTABLISHED |TCPF_SYN_RECV | -TCPF_CLOSE_WAIT |TCPF_CLOSE ))); +TCPF_FIN_WAIT1 |TCPF_FIN_WAIT2 | +TCPF_CLOSING |TCPF_CLOSE_WAIT | +TCPF_CLOSE )));if (test_bit (SOCK_SUPPORT_ZC , &sock->flags))set_bit (SOCK_SUPPORT_ZC , &newsock->flags);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 427/473 nfc: nci: Fix kcov check in nci_rx_work()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 19e35f24750ddf860c51e51c68cf07ea181b4881 ]
Commit 7e8cdc97148c ("nfc: Add KCOV annotations") added kcov_remote_start_common()/kcov_remote_stop() pair into nci_rx_work(), with an assumption that kcov_remote_stop() is called upon continue of the for loop. But commit d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet") forgot to call kcov_remote_stop() before break of the for loop.
Stable-dep-of: 6671e352497c ("nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()")
--- net/nfc/nci/core.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/nci/core.c +1 -0
@@ -1527,6 +1527,7 @@ static void nci_rx_work(struct work_struct *work)if (!nci_valid_size (skb)) {kfree_skb (skb); +kcov_remote_stop ();break ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 428/473 nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryosuke Yasuoka <[email protected]>
[ Upstream commit 6671e352497ca4bb07a96c48e03907065ff77d8a ]
When nci_rx_work() receives a zero-length payload packet, it should not discard the packet and exit the loop. Instead, it should continue processing subsequent packets.
--- net/nfc/nci/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/nfc/nci/core.c +1 -2
@@ -1527,8 +1527,7 @@ static void nci_rx_work(struct work_struct *work)if (!nci_valid_size (skb)) {kfree_skb (skb); -kcov_remote_stop (); -break ; +continue ; }/* Process frame */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 429/473 drivers/xen: Improve the late XenStore init protocol
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Wang <[email protected]>
[ Upstream commit a3607581cd49c17128a486a526a36a97bafcb2bb ]
Currently, the late XenStore init protocol is only triggered properly for the case that HVM_PARAM_STORE_PFN is ~0ULL (invalid). For the case that XenStore interface is allocated but not ready (the connection status is not XENSTORE_CONNECTED), Linux should also wait until the XenStore is set up properly.
Introduce a macro to describe the XenStore interface is ready, use it in xenbus_probe_initcall() to select the code path of doing the late XenStore init protocol or not. Since now we have more than one condition for XenStore late init, rework the check in xenbus_probe() for the free_irq().
Take the opportunity to enhance the check of the allocated XenStore interface can be properly mapped, and return error early if the memremap() fails.
--- drivers/xen/xenbus/xenbus_probe.c | 36 ++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-)
drivers/xen/xenbus/xenbus_probe.c +23 -13
@@ -65,13 +65,17 @@#include "xenbus.h" -static int xs_init_irq; +static int xs_init_irq =-1 ;int xen_store_evtchn;EXPORT_SYMBOL_GPL (xen_store_evtchn);struct xenstore_domain_interface *xen_store_interface;EXPORT_SYMBOL_GPL (xen_store_interface); +#define XS_INTERFACE_READY \ + ((xen_store_interface != NULL) && \ + (xen_store_interface->connection == XENSTORE_CONNECTED)) +enum xenstore_init xen_store_domain_type;EXPORT_SYMBOL_GPL (xen_store_domain_type);
@@ -751,19 +755,19 @@ static void xenbus_probe(void) { xenstored_ready =1 ; -if (!xen_store_interface) { +if (!xen_store_interface) xen_store_interface =memremap (xen_store_gfn <<XEN_PAGE_SHIFT ,XEN_PAGE_SIZE ,MEMREMAP_WB ); -/* -* Now it is safe to free the IRQ used for xenstore late -* initialization. No need to unbind: it is about to be -* bound again from xb_init_comms. Note that calling -* unbind_from_irqhandler now would result in xen_evtchn_close() -* being called and the event channel not being enabled again -* afterwards, resulting in missed event notifications. -*/ +/* +* Now it is safe to free the IRQ used for xenstore late +* initialization. No need to unbind: it is about to be +* bound again from xb_init_comms. Note that calling +* unbind_from_irqhandler now would result in xen_evtchn_close() +* being called and the event channel not being enabled again +* afterwards, resulting in missed event notifications. +*/ +if (xs_init_irq >=0 )free_irq (xs_init_irq, &xb_waitq); - }/* * In the HVM case, xenbus_init() deferred its call to
@@ -822,7 +826,7 @@ static int __init xenbus_probe_initcall(void)if (xen_store_domain_type ==XS_PV || (xen_store_domain_type ==XS_HVM && !xs_hvm_defer_init_for_callback () && - xen_store_interface !=NULL )) +XS_INTERFACE_READY ))xenbus_probe ();/*
@@ -831,7 +835,7 @@ static int __init xenbus_probe_initcall(void)* started, then probe. It will be triggered when communication * starts happening, by waiting on xb_waitq. */ -if (xen_store_domain_type ==XS_LOCAL || xen_store_interface ==NULL ) { +if (xen_store_domain_type ==XS_LOCAL || !XS_INTERFACE_READY ) {struct task_struct *probe_task; probe_task = kthread_run(xenbus_probe_thread, NULL,
@@ -1014,6 +1018,12 @@ static int __init xenbus_init(void) xen_store_interface =memremap (xen_store_gfn <<XEN_PAGE_SHIFT ,XEN_PAGE_SIZE ,MEMREMAP_WB ); +if (!xen_store_interface) { +pr_err ("%s: cannot map HVM_PARAM_STORE_PFN=%llx\n" , + __func__, v); + err = -EINVAL ; + goto out_error; + }if (xen_store_interface->connection !=XENSTORE_CONNECTED ) wait = true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 430/473 ice: Interpret .set_channels() input differently
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larysa Zaremba <[email protected]>
[ Upstream commit 05d6f442f31f901d27dbc64fd504a8ec7d5013de ]
A bug occurs because a safety check guarding AF_XDP-related queues in ethnl_set_channels(), does not trigger. This happens, because kernel and ice driver interpret the ethtool command differently.
How the bug occurs:
1. ethtool -l <IFNAME> -> combined: 40
2. Attach AF_XDP to queue 30
3. ethtool -L <IFNAME> rx 15 tx 15
combined number is not specified, so command becomes {rx_count = 15, tx_count = 15, combined_count = 40}.
4. ethnl_set_channels checks, if there are any AF_XDP of queues from the new (combined_count + rx_count) to the old one, so from 55 to 40, check does not trigger.
5. ice interprets rx 15 tx 15 as 15 combined channels and deletes the queue that AF_XDP is attached to.
Interpret the command in a way that is more consistent with ethtool manual [0] (--show-channels and --set-channels).
Considering that in the ice driver only the difference between RX and TX queues forms dedicated channels, change the correct way to set number of channels to:
ethtool -L <IFNAME> combined 10 /* For symmetric queues */ ethtool -L <IFNAME> combined 8 tx 2 rx 0 /* For asymmetric queues */
[0] https://man7.org/linux/man-pages/man8/ethtool.8.html
--- drivers/net/ethernet/intel/ice/ice_ethtool.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
drivers/net/ethernet/intel/ice/ice_ethtool.c +2 -17
@@ -3473,7 +3473,6 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)struct ice_pf *pf = vsi->back;int new_rx =0 , new_tx =0 ;bool locked = false; -u32 curr_combined;int ret =0 ;/* do not support changing channels in Safe Mode */
@@ -3495,22 +3494,8 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)return -EOPNOTSUPP ; } - curr_combined =ice_get_combined_cnt (vsi); - -/* these checks are for cases where user didn't specify a particular -* value on cmd line but we get non-zero value anyway via -* get_channels(); look at ethtool.c in ethtool repository (the user -* space part), particularly, do_schannels() routine -*/ -if (ch->rx_count == vsi->num_rxq - curr_combined) - ch->rx_count =0 ; -if (ch->tx_count == vsi->num_txq - curr_combined) - ch->tx_count =0 ; -if (ch->combined_count == curr_combined) - ch->combined_count =0 ; - -if (!(ch->combined_count || (ch->rx_count && ch->tx_count))) { -netdev_err (dev,"Please specify at least 1 Rx and 1 Tx channel\n" ); +if (ch->rx_count && ch->tx_count) { +netdev_err (dev,"Dedicated RX or TX channels cannot be used simultaneously\n" );return -EINVAL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 431/473 netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit dc21c6cc3d6986d938efbf95de62473982c98dec ]
syzbot reported that nf_reinject() could be called without rcu_read_lock() :
WARNING: suspicious RCU usage 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Not tainted
net/netfilter/nfnetlink_queue.c:263 suspicious rcu_dereference_check() usage!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
2 locks held by syz-executor.4/13427:
#0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline] #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2190 [inline] #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_core+0xa86/0x1830 kernel/rcu/tree.c:2471 #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline] #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: nfqnl_flush net/netfilter/nfnetlink_queue.c:405 [inline] #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: instance_destroy_rcu+0x30/0x220 net/netfilter/nfnetlink_queue.c:172
stack backtrace: CPU: 0 PID: 13427 Comm: syz-executor.4 Not tainted 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114 lockdep_rcu_suspicious+0x221/0x340 kernel/locking/lockdep.c:6712 nf_reinject net/netfilter/nfnetlink_queue.c:323 [inline] nfqnl_reinject+0x6ec/0x1120 net/netfilter/nfnetlink_queue.c:397 nfqnl_flush net/netfilter/nfnetlink_queue.c:410 [inline] instance_destroy_rcu+0x1ae/0x220 net/netfilter/nfnetlink_queue.c:172 rcu_do_batch kernel/rcu/tree.c:2196 [inline] rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2471 handle_softirqs+0x2d6/0x990 kernel/softirq.c:554 __do_softirq kernel/softirq.c:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637 irq_exit_rcu+0x9/0x30 kernel/softirq.c:649 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline] sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043 </IRQ> <TASK>
--- net/netfilter/nfnetlink_queue.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nfnetlink_queue.c +2 -0
@@ -167,7 +167,9 @@ instance_destroy_rcu(struct rcu_head *head) struct nfqnl_instance *inst = container_of(head, struct nfqnl_instance, rcu); +rcu_read_lock ();nfqnl_flush (inst,NULL ,0 ); +rcu_read_unlock ();kfree (inst);module_put (THIS_MODULE ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 432/473 netfilter: nft_payload: restore vlan q-in-q match support
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pablo Neira Ayuso <[email protected]>
[ Upstream commit aff5c01fa1284d606f8e7cbdaafeef2511bb46c1 ]
Revert f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support").
f41f72d09ee1 ("netfilter: nft_payload: simplify vlan header handling") already allows to match on inner vlan tags by subtract the vlan header size to the payload offset which has been popped and stored in skbuff metadata fields.
--- net/netfilter/nft_payload.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
net/netfilter/nft_payload.c +7 -16
@@ -44,36 +44,27 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)int mac_off =skb_mac_header (skb) - skb->data;u8 *vlanh, *dst_u8 = (u8 *) d;struct vlan_ethhdr veth; -u8 vlan_hlen =0 ; - -if ((skb->protocol ==htons (ETH_P_8021AD ) || - skb->protocol ==htons (ETH_P_8021Q )) && - offset >=VLAN_ETH_HLEN && offset <VLAN_ETH_HLEN +VLAN_HLEN ) - vlan_hlen +=VLAN_HLEN ; vlanh = (u8 *) &veth; -if (offset <VLAN_ETH_HLEN + vlan_hlen) { +if (offset <VLAN_ETH_HLEN ) {u8 ethlen = len; -if (vlan_hlen && -skb_copy_bits (skb, mac_off, &veth,VLAN_ETH_HLEN ) <0 ) -return false; -else if (!nft_payload_rebuild_vlan_hdr (skb, mac_off, &veth)) +if (!nft_payload_rebuild_vlan_hdr (skb, mac_off, &veth))return false; -if (offset + len >VLAN_ETH_HLEN + vlan_hlen) - ethlen -= offset + len -VLAN_ETH_HLEN - vlan_hlen; +if (offset + len >VLAN_ETH_HLEN ) + ethlen -= offset + len -VLAN_ETH_HLEN ; -memcpy (dst_u8, vlanh + offset - vlan_hlen, ethlen); +memcpy (dst_u8, vlanh + offset, ethlen); len -= ethlen;if (len ==0 )return true; dst_u8 += ethlen; - offset =ETH_HLEN + vlan_hlen; + offset =ETH_HLEN ; }else { - offset -=VLAN_HLEN + vlan_hlen; + offset -=VLAN_HLEN ; }return skb_copy_bits (skb, offset + mac_off, dst_u8, len) ==0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 433/473 spi: Dont mark message DMA mapped when no transfer in it is
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 9f788ba457b45b0ce422943fcec9fa35c4587764 ]
There is no need to set the DMA mapped flag of the message if it has no mapped transfers. Moreover, it may give the code a chance to take the wrong paths, i.e. to exercise DMA related APIs on unmapped data. Make __spi_map_msg() to bail earlier on the above mentioned cases.
--- drivers/spi/spi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/spi/spi.c +4 -0
@@ -1147,6 +1147,7 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)else rx_dev = ctlr->dev.parent; + ret = -ENOMSG ;list_for_each_entry (xfer, &msg->transfers, transfer_list) {/* The sync is done before each transfer. */ unsigned long attrs =DMA_ATTR_SKIP_CPU_SYNC ;
@@ -1176,6 +1177,9 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg) } } } +/* No transfer has been mapped, bail out with success */ +if (ret) +return 0 ; ctlr->cur_rx_dma_dev = rx_dev; ctlr->cur_tx_dma_dev = tx_dev;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 434/473 dma-mapping: benchmark: fix node id validation
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit 1ff05e723f7ca30644b8ec3fb093f16312e408ad ]
While validating node ids in map_benchmark_ioctl(), node_possible() may be provided with invalid argument outside of [0,MAX_NUMNODES-1] range leading to:
BUG: KASAN: wild-memory-access in map_benchmark_ioctl (kernel/dma/map_benchmark.c:214) Read of size 8 at addr 1fffffff8ccb6398 by task dma_map_benchma/971 CPU: 7 PID: 971 Comm: dma_map_benchma Not tainted 6.9.0-rc6 #37 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: <TASK>
dump_stack_lvl (lib/dump_stack.c:117)kasan_report (mm/kasan/report.c:603)kasan_check_range (mm/kasan/generic.c:189)variable_test_bit (arch/x86/include/asm/bitops.h:227) [inline] arch_test_bit (arch/x86/include/asm/bitops.h:239) [inline] _test_bit at (include/asm-generic/bitops/instrumented-non-atomic.h:142) [inline] node_state (include/linux/nodemask.h:423) [inline] map_benchmark_ioctl (kernel/dma/map_benchmark.c:214) full_proxy_unlocked_ioctl (fs/debugfs/file.c:333)__x64_sys_ioctl (fs/ioctl.c:890)do_syscall_64 (arch/x86/entry/common.c:83) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
Compare node ids with sane bounds first. NUMA_NO_NODE is considered a special valid case meaning that benchmarking kthreads won't be bound to a cpuset of a given node.
Found by Linux Verification Center (linuxtesting.org).
--- kernel/dma/map_benchmark.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/dma/map_benchmark.c +2 -1
@@ -208,7 +208,8 @@ static long map_benchmark_ioctl(struct file *file, unsigned int cmd, }if (map->bparam.node !=NUMA_NO_NODE && - !node_possible (map->bparam.node)) { + (map->bparam.node <0 || map->bparam.node >=MAX_NUMNODES || + !node_possible (map->bparam.node))) {pr_err ("invalid numa node\n" );return -EINVAL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 435/473 dma-mapping: benchmark: handle NUMA_NO_NODE correctly
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
[ Upstream commit e64746e74f717961250a155e14c156616fcd981f ]
cpumask_of_node() can be called for NUMA_NO_NODE inside do_map_benchmark() resulting in the following sanitizer report:
UBSAN: array-index-out-of-bounds in ./arch/x86/include/asm/topology.h:72:28 index -1 is out of range for type 'cpumask [64][1]' CPU: 1 PID: 990 Comm: dma_map_benchma Not tainted 6.9.0-rc6 #29 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996) Call Trace: <TASK>
dump_stack_lvl (lib/dump_stack.c:117)ubsan_epilogue (lib/ubsan.c:232) __ubsan_handle_out_of_bounds (lib/ubsan.c:429) cpumask_of_node (arch/x86/include/asm/topology.h:72) [inline] do_map_benchmark (kernel/dma/map_benchmark.c:104) map_benchmark_ioctl (kernel/dma/map_benchmark.c:246) full_proxy_unlocked_ioctl (fs/debugfs/file.c:333) __x64_sys_ioctl (fs/ioctl.c:890)do_syscall_64 (arch/x86/entry/common.c:83) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
Use cpumask_of_node() in place when binding a kernel thread to a cpuset of a particular node.
Note that the provided node id is checked inside map_benchmark_ioctl(). It's just a NUMA_NO_NODE case which is not handled properly later.
Found by Linux Verification Center (linuxtesting.org).
--- kernel/dma/map_benchmark.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/dma/map_benchmark.c +1 -2
@@ -101,7 +101,6 @@ static int do_map_benchmark(struct map_benchmark_data *map)struct task_struct **tsk;int threads = map->bparam.threads;int node = map->bparam.node; -const cpumask_t *cpu_mask =cpumask_of_node (node);u64 loops;int ret =0 ;int i;
@@ -122,7 +121,7 @@ static int do_map_benchmark(struct map_benchmark_data *map) }if (node !=NUMA_NO_NODE ) -kthread_bind_mask (tsk[i], cpu_mask); +kthread_bind_mask (tsk[i],cpumask_of_node (node)); }/* clear the old value in the previous benchmark */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 436/473 nvmet: fix ns enable/disable possible hang
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sagi Grimberg <[email protected]>
[ Upstream commit f97914e35fd98b2b18fb8a092e0a0799f73afdfe ]
When disabling an nvmet namespace, there is a period where the subsys->lock is released, as the ns disable waits for backend IO to complete, and the ns percpu ref to be properly killed. The original intent was to avoid taking the subsystem lock for a prolong period as other processes may need to acquire it (for example new incoming connections).
However, it opens up a window where another process may come in and enable the ns, (re)intiailizing the ns percpu_ref, causing the disable sequence to hang.
Solve this by taking the global nvmet_config_sem over the entire configfs enable/disable sequence.
--- drivers/nvme/target/configfs.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/nvme/target/configfs.c +8 -0
@@ -537,10 +537,18 @@ static ssize_t nvmet_ns_enable_store(struct config_item *item,if (strtobool (page, &enable))return -EINVAL ; +/* +* take a global nvmet_config_sem because the disable routine has a +* window where it releases the subsys-lock, giving a chance to +* a parallel enable to concurrently execute causing the disable to +* have a misaccounting of the ns percpu_ref. +*/ +down_write (&nvmet_config_sem);if (enable) ret =nvmet_ns_enable (ns);else nvmet_ns_disable (ns); +up_write (&nvmet_config_sem);return ret ? ret : count; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 437/473 net: phy: micrel: set soft_reset callback to genphy_soft_reset for KSZ8061
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathieu Othacehe <[email protected]>
[ Upstream commit 128d54fbcb14b8717ecf596d3dbded327b9980b3 ]
Following a similar reinstate for the KSZ8081 and KSZ9031.
Older kernels would use the genphy_soft_reset if the PHY did not implement a .soft_reset.
The KSZ8061 errata described here:
https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ8061-Errata-DS80000688B.pdf
and worked around with 232ba3a51c ("net: phy: Micrel KSZ8061: link failure after cable connect") is back again without this soft reset.
--- drivers/net/phy/micrel.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/phy/micrel.c +1 -0
@@ -3245,6 +3245,7 @@ static struct phy_driver ksphy_driver[] = {/* PHY_BASIC_FEATURES */ .probe = kszphy_probe, .config_init = ksz8061_config_init, + .soft_reset = genphy_soft_reset, .config_intr = kszphy_config_intr, .handle_interrupt = kszphy_handle_interrupt, .suspend = kszphy_suspend,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 438/473 net/mlx5: Lag, do bond only if slaves agree on roce state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maher Sanalla <[email protected]>
[ Upstream commit 51ef9305b8f40946d65c40368ffb4c14636d369a ]
Currently, the driver does not enforce that lag bond slaves must have matching roce capabilities. Yet, in mlx5_do_bond(), the driver attempts to enable roce on all vports of the bond slaves, causing the following syndrome when one slave has no roce fw support:
mlx5_cmd_out_err:809:(pid 25427): MODIFY_NIC_VPORT_CONTEXT(0×755) op_mod(0×0) failed, status bad parameter(0×3), syndrome (0xc1f678), err(-22)
Thus, create HW lag only if bond's slaves agree on roce state, either all slaves have roce support resulting in a roce lag bond, or none do, resulting in a raw eth bond.
--- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +10 -2
@@ -696,6 +696,7 @@ static bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)struct mlx5_core_dev *dev;u8 mode;#endif +bool roce_support;int i;for (i =0 ; i < ldev->ports; i++)
@@ -722,6 +723,11 @@ static bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)if (mlx5_sriov_is_enabled (ldev->pf[i].dev))return false;#endif + roce_support =mlx5_get_roce_state (ldev->pf[MLX5_LAG_P1 ].dev); +for (i =1 ; i < ldev->ports; i++) +if (mlx5_get_roce_state (ldev->pf[i].dev) != roce_support) +return false; +return true; }
@@ -884,8 +890,10 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) }else if (roce_lag) { dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV ;mlx5_rescan_drivers_locked (dev0); -for (i =1 ; i < ldev->ports; i++) -mlx5_nic_vport_enable_roce (ldev->pf[i].dev); +for (i =1 ; i < ldev->ports; i++) { +if (mlx5_get_roce_state (ldev->pf[i].dev)) +mlx5_nic_vport_enable_roce (ldev->pf[i].dev); + } }else if (shared_fdb) { dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV ;mlx5_rescan_drivers_locked (dev0);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 439/473 net/mlx5e: Fix IPsec tunnel mode offload feature check
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rahul Rameshbabu <[email protected]>
[ Upstream commit 9a52f6d44f4521773b4699b4ed34b8e21d5a175c ]
Remove faulty check disabling checksum offload and GSO for offload of simple IPsec tunnel L4 traffic. Comment previously describing the deleted code incorrectly claimed the check prevented double tunnel (or three layers of ip headers).
--- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h +5 -12
@@ -97,18 +97,11 @@ mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features)if (!x || !x->xso.offload_handle) goto out_disable; -if (xo->inner_ipproto) { -/* Cannot support tunnel packet over IPsec tunnel mode -* because we cannot offload three IP header csum -*/ -if (x->props.mode ==XFRM_MODE_TUNNEL ) - goto out_disable; - -/* Only support UDP or TCP L4 checksum */ -if (xo->inner_ipproto !=IPPROTO_UDP && - xo->inner_ipproto !=IPPROTO_TCP ) - goto out_disable; - } +/* Only support UDP or TCP L4 checksum */ +if (xo->inner_ipproto && + xo->inner_ipproto !=IPPROTO_UDP && + xo->inner_ipproto !=IPPROTO_TCP ) + goto out_disable;return features;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 440/473 net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting buffer exhaustion
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carolina Jubran <[email protected]>
[ Upstream commit 5c74195d5dd977e97556e6fa76909b831c241230 ]
Previously, the driver incorrectly used rx_dropped to report device buffer exhaustion.
According to the documentation, rx_dropped should not be used to count packets dropped due to buffer exhaustion, which is the purpose of rx_missed_errors.
Use rx_missed_errors as intended for counting packets dropped due to buffer exhaustion.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +1 -1
@@ -3666,7 +3666,7 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)mlx5e_fold_sw_stats64 (priv, stats); } - stats->rx_dropped = priv->stats.qcnt.rx_out_of_buffer; + stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer; stats->rx_length_errors = PPORT_802_3_GET(pstats, a_in_range_length_errors) +
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 441/473 net/mlx5e: Fix UDP GSO for encapsulated packets
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gal Pressman <[email protected]>
[ Upstream commit 83fea49f2711fc90c0d115b0ed04046b45155b65 ]
When the skb is encapsulated, adjust the inner UDP header instead of the outer one, and account for UDP header (instead of TCP) in the inline header size calculation.
--- .../net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 8 +++++++- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h +7 -1
@@ -102,8 +102,14 @@ static inline void mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb) {int payload_len =skb_shinfo (skb)->gso_size +sizeof (struct udphdr ); +struct udphdr *udphdr; -udp_hdr (skb)->len =htons (payload_len); +if (skb->encapsulation) + udphdr = (struct udphdr *)skb_inner_transport_header (skb); +else + udphdr =udp_hdr (skb); + + udphdr->len =htons (payload_len); }struct mlx5e_accel_tx_state {
drivers/net/ethernet/mellanox/mlx5/core/en_tx.c +5 -1
@@ -153,7 +153,11 @@ mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop) *hopbyhop =0 ;if (skb->encapsulation) { - ihs =skb_inner_tcp_all_headers (skb); +if (skb_shinfo (skb)->gso_type &SKB_GSO_UDP_L4 ) + ihs =skb_inner_transport_offset (skb) + +sizeof (struct udphdr ); +else + ihs =skb_inner_tcp_all_headers (skb); stats->tso_inner_packets++; stats->tso_inner_bytes += skb->len - ihs; }else {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 442/473 dma-buf/sw-sync: dont enable IRQ from sync_print_obj()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit b794918961516f667b0c745aebdfebbb8a98df39 ]
Since commit a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context") by error replaced spin_unlock_irqrestore() with spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite sync_print_obj() is called from sync_debugfs_show(), lockdep complains inconsistent lock state warning.
Use plain spin_{lock,unlock}() for sync_print_obj(), for sync_debugfs_show() is already using spin_{lock,unlock}_irq().
--- drivers/dma-buf/sync_debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma-buf/sync_debug.c +2 -2
@@ -110,12 +110,12 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)seq_printf (s,"%s: %d\n" , obj->name, obj->value); -spin_lock_irq (&obj->lock); +spin_lock (&obj->lock);/* Caller already disabled IRQ. */ list_for_each (pos, &obj->pt_list) { struct sync_pt *pt = container_of(pos, struct sync_pt, link);sync_print_fence (s, &pt->base, false); } -spin_unlock_irq (&obj->lock); +spin_unlock (&obj->lock); } static void sync_print_sync_file(struct seq_file *s,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 443/473 bpf: Fix potential integer overflow in resolve_btfids
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Friedrich Vock <[email protected]>
[ Upstream commit 44382b3ed6b2787710c8ade06c0e97f5970a47c8 ]
err is a 32-bit integer, but elf_update returns an off_t, which is 64-bit at least on 64-bit platforms. If symbols_patch is called on a binary between 2-4GB in size, the result will be negative when cast to a 32-bit integer, which the code assumes means an error occurred. This can wrongly trigger build failures when building very large kernel images.
--- tools/bpf/resolve_btfids/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/resolve_btfids/main.c +1 -1
@@ -728,7 +728,7 @@ static int sets_patch(struct object *obj)static int symbols_patch (struct object *obj) { -int err; +off_t err; if (__symbols_patch(obj, &obj->structs) || __symbols_patch(obj, &obj->unions) ||
Signature · 1 line
2.43.0