From: Greg Kroah-Hartman Date: Wed, 19 Jun 2024 11:27:01 +0000 (+0200) Subject: 6.6-stable patches X-Git-Tag: v6.1.95~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11f3577752643e2b1124684d2dda64086a62faff;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: cachefiles-erofs-fix-null-deref-in-when-cachefiles-is-not-doing-ondemand-mode.patch selftests-net-lib-avoid-error-removing-empty-netns-name.patch selftests-net-lib-no-need-to-record-ns-name-if-it-already-exist.patch selftests-net-lib-support-errexit-with-busywait.patch selftests-net-lib-update-busywait-timeout-value.patch --- diff --git a/queue-6.6/cachefiles-erofs-fix-null-deref-in-when-cachefiles-is-not-doing-ondemand-mode.patch b/queue-6.6/cachefiles-erofs-fix-null-deref-in-when-cachefiles-is-not-doing-ondemand-mode.patch new file mode 100644 index 00000000000..952a1f202c2 --- /dev/null +++ b/queue-6.6/cachefiles-erofs-fix-null-deref-in-when-cachefiles-is-not-doing-ondemand-mode.patch @@ -0,0 +1,57 @@ +From c3d6569a43322f371e7ba0ad386112723757ac8f Mon Sep 17 00:00:00 2001 +From: David Howells +Date: Fri, 19 Jan 2024 20:49:34 +0000 +Subject: cachefiles, erofs: Fix NULL deref in when cachefiles is not doing ondemand-mode + +From: David Howells + +commit c3d6569a43322f371e7ba0ad386112723757ac8f upstream. + +cachefiles_ondemand_init_object() as called from cachefiles_open_file() and +cachefiles_create_tmpfile() does not check if object->ondemand is set +before dereferencing it, leading to an oops something like: + + RIP: 0010:cachefiles_ondemand_init_object+0x9/0x41 + ... + Call Trace: + + cachefiles_open_file+0xc9/0x187 + cachefiles_lookup_cookie+0x122/0x2be + fscache_cookie_state_machine+0xbe/0x32b + fscache_cookie_worker+0x1f/0x2d + process_one_work+0x136/0x208 + process_scheduled_works+0x3a/0x41 + worker_thread+0x1a2/0x1f6 + kthread+0xca/0xd2 + ret_from_fork+0x21/0x33 + +Fix this by making cachefiles_ondemand_init_object() return immediately if +cachefiles->ondemand is NULL. + +Fixes: 3c5ecfe16e76 ("cachefiles: extract ondemand info field from cachefiles_object") +Reported-by: Marc Dionne +Signed-off-by: David Howells +cc: Gao Xiang +cc: Chao Yu +cc: Yue Hu +cc: Jeffle Xu +cc: linux-erofs@lists.ozlabs.org +cc: netfs@lists.linux.dev +cc: linux-fsdevel@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + fs/cachefiles/ondemand.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/fs/cachefiles/ondemand.c ++++ b/fs/cachefiles/ondemand.c +@@ -611,6 +611,9 @@ int cachefiles_ondemand_init_object(stru + struct fscache_volume *volume = object->volume->vcookie; + size_t volume_key_size, cookie_key_size, data_len; + ++ if (!object->ondemand) ++ return 0; ++ + /* + * CacheFiles will firstly check the cache file under the root cache + * directory. If the coherency check failed, it will fallback to diff --git a/queue-6.6/selftests-net-lib-avoid-error-removing-empty-netns-name.patch b/queue-6.6/selftests-net-lib-avoid-error-removing-empty-netns-name.patch new file mode 100644 index 00000000000..2beb7b5413a --- /dev/null +++ b/queue-6.6/selftests-net-lib-avoid-error-removing-empty-netns-name.patch @@ -0,0 +1,84 @@ +From 79322174bcc780b99795cb89d237b26006a8b94b Mon Sep 17 00:00:00 2001 +From: "Matthieu Baerts (NGI0)" +Date: Wed, 5 Jun 2024 11:21:17 +0200 +Subject: selftests: net: lib: avoid error removing empty netns name + +From: Matthieu Baerts (NGI0) + +commit 79322174bcc780b99795cb89d237b26006a8b94b upstream. + +If there is an error to create the first netns with 'setup_ns()', +'cleanup_ns()' will be called with an empty string as first parameter. + +The consequences is that 'cleanup_ns()' will try to delete an invalid +netns, and wait 20 seconds if the netns list is empty. + +Instead of just checking if the name is not empty, convert the string +separated by spaces to an array. Manipulating the array is cleaner, and +calling 'cleanup_ns()' with an empty array will be a no-op. + +Fixes: 25ae948b4478 ("selftests/net: add lib.sh") +Cc: stable@vger.kernel.org +Acked-by: Geliang Tang +Signed-off-by: Matthieu Baerts (NGI0) +Reviewed-by: Petr Machata +Reviewed-by: Hangbin Liu +Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-2-b3afadd368c9@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/lib.sh | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +--- a/tools/testing/selftests/net/lib.sh ++++ b/tools/testing/selftests/net/lib.sh +@@ -10,7 +10,7 @@ BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000) + # Kselftest framework requirement - SKIP code is 4. + ksft_skip=4 + # namespace list created by setup_ns +-NS_LIST="" ++NS_LIST=() + + ############################################################################## + # Helpers +@@ -48,6 +48,7 @@ cleanup_ns() + fi + + for ns in "$@"; do ++ [ -z "${ns}" ] && continue + ip netns delete "${ns}" &> /dev/null + if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then + echo "Warn: Failed to remove namespace $ns" +@@ -61,7 +62,7 @@ cleanup_ns() + + cleanup_all_ns() + { +- cleanup_ns $NS_LIST ++ cleanup_ns "${NS_LIST[@]}" + } + + # setup netns with given names as prefix. e.g +@@ -70,7 +71,7 @@ setup_ns() + { + local ns="" + local ns_name="" +- local ns_list="" ++ local ns_list=() + local ns_exist= + for ns_name in "$@"; do + # Some test may setup/remove same netns multi times +@@ -86,11 +87,11 @@ setup_ns() + + if ! ip netns add "$ns"; then + echo "Failed to create namespace $ns_name" +- cleanup_ns "$ns_list" ++ cleanup_ns "${ns_list[@]}" + return $ksft_skip + fi + ip -n "$ns" link set lo up +- ! $ns_exist && ns_list="$ns_list $ns" ++ ! $ns_exist && ns_list+=("$ns") + done +- NS_LIST="$NS_LIST $ns_list" ++ NS_LIST+=("${ns_list[@]}") + } diff --git a/queue-6.6/selftests-net-lib-no-need-to-record-ns-name-if-it-already-exist.patch b/queue-6.6/selftests-net-lib-no-need-to-record-ns-name-if-it-already-exist.patch new file mode 100644 index 00000000000..fd5bc05d546 --- /dev/null +++ b/queue-6.6/selftests-net-lib-no-need-to-record-ns-name-if-it-already-exist.patch @@ -0,0 +1,51 @@ +From 83e93942796db58652288f0391ac00072401816f Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Tue, 14 May 2024 10:33:59 +0800 +Subject: selftests/net/lib: no need to record ns name if it already exist + +From: Hangbin Liu + +commit 83e93942796db58652288f0391ac00072401816f upstream. + +There is no need to add the name to ns_list again if the netns already +recoreded. + +Fixes: 25ae948b4478 ("selftests/net: add lib.sh") +Signed-off-by: Hangbin Liu +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/lib.sh | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/tools/testing/selftests/net/lib.sh ++++ b/tools/testing/selftests/net/lib.sh +@@ -73,15 +73,17 @@ setup_ns() + local ns="" + local ns_name="" + local ns_list="" ++ local ns_exist= + for ns_name in "$@"; do + # Some test may setup/remove same netns multi times + if unset ${ns_name} 2> /dev/null; then + ns="${ns_name,,}-$(mktemp -u XXXXXX)" + eval readonly ${ns_name}="$ns" ++ ns_exist=false + else + eval ns='$'${ns_name} + cleanup_ns "$ns" +- ++ ns_exist=true + fi + + if ! ip netns add "$ns"; then +@@ -90,7 +92,7 @@ setup_ns() + return $ksft_skip + fi + ip -n "$ns" link set lo up +- ns_list="$ns_list $ns" ++ ! $ns_exist && ns_list="$ns_list $ns" + done + NS_LIST="$NS_LIST $ns_list" + } diff --git a/queue-6.6/selftests-net-lib-support-errexit-with-busywait.patch b/queue-6.6/selftests-net-lib-support-errexit-with-busywait.patch new file mode 100644 index 00000000000..88e7ae3fb81 --- /dev/null +++ b/queue-6.6/selftests-net-lib-support-errexit-with-busywait.patch @@ -0,0 +1,40 @@ +From 41b02ea4c0adfcc6761fbfed42c3ce6b6412d881 Mon Sep 17 00:00:00 2001 +From: "Matthieu Baerts (NGI0)" +Date: Wed, 5 Jun 2024 11:21:16 +0200 +Subject: selftests: net: lib: support errexit with busywait + +From: Matthieu Baerts (NGI0) + +commit 41b02ea4c0adfcc6761fbfed42c3ce6b6412d881 upstream. + +If errexit is enabled ('set -e'), loopy_wait -- or busywait and others +using it -- will stop after the first failure. + +Note that if the returned status of loopy_wait is checked, and even if +errexit is enabled, Bash will not stop at the first error. + +Fixes: 25ae948b4478 ("selftests/net: add lib.sh") +Cc: stable@vger.kernel.org +Acked-by: Geliang Tang +Signed-off-by: Matthieu Baerts (NGI0) +Reviewed-by: Hangbin Liu +Link: https://lore.kernel.org/r/20240605-upstream-net-20240605-selftests-net-lib-fixes-v1-1-b3afadd368c9@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/lib.sh | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +--- a/tools/testing/selftests/net/lib.sh ++++ b/tools/testing/selftests/net/lib.sh +@@ -22,9 +22,7 @@ busywait() + while true + do + local out +- out=$("$@") +- local ret=$? +- if ((!ret)); then ++ if out=$("$@"); then + echo -n "$out" + return 0 + fi diff --git a/queue-6.6/selftests-net-lib-update-busywait-timeout-value.patch b/queue-6.6/selftests-net-lib-update-busywait-timeout-value.patch new file mode 100644 index 00000000000..a59b7db291a --- /dev/null +++ b/queue-6.6/selftests-net-lib-update-busywait-timeout-value.patch @@ -0,0 +1,46 @@ +From fc836129f708407502632107e58d48f54b1caf75 Mon Sep 17 00:00:00 2001 +From: Hangbin Liu +Date: Wed, 24 Jan 2024 14:13:44 +0800 +Subject: selftests/net/lib: update busywait timeout value + +From: Hangbin Liu + +commit fc836129f708407502632107e58d48f54b1caf75 upstream. + +The busywait timeout value is a millisecond, not a second. So the +current setting 2 is too small. On slow/busy host (or VMs) the +current timeout can expire even on "correct" execution, causing random +failures. Let's copy the WAIT_TIMEOUT from forwarding/lib.sh and set +BUSYWAIT_TIMEOUT here. + +Fixes: 25ae948b4478 ("selftests/net: add lib.sh") +Signed-off-by: Hangbin Liu +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/20240124061344.1864484-1-liuhangbin@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/lib.sh | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/tools/testing/selftests/net/lib.sh ++++ b/tools/testing/selftests/net/lib.sh +@@ -4,6 +4,9 @@ + ############################################################################## + # Defines + ++WAIT_TIMEOUT=${WAIT_TIMEOUT:=20} ++BUSYWAIT_TIMEOUT=$((WAIT_TIMEOUT * 1000)) # ms ++ + # Kselftest framework requirement - SKIP code is 4. + ksft_skip=4 + # namespace list created by setup_ns +@@ -48,7 +51,7 @@ cleanup_ns() + + for ns in "$@"; do + ip netns delete "${ns}" &> /dev/null +- if ! busywait 2 ip netns list \| grep -vq "^$ns$" &> /dev/null; then ++ if ! busywait $BUSYWAIT_TIMEOUT ip netns list \| grep -vq "^$ns$" &> /dev/null; then + echo "Warn: Failed to remove namespace $ns" + ret=1 + fi diff --git a/queue-6.6/series b/queue-6.6/series index 11985923a20..db18c07cefa 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -247,3 +247,8 @@ selftests-net-add-lib.sh.patch selftests-net-add-variable-ns_list-for-lib.sh.patch selftests-forwarding-avoid-failures-to-source-net-lib.sh.patch remoteproc-k3-r5-jump-to-error-handling-labels-in-start-stop-errors.patch +cachefiles-erofs-fix-null-deref-in-when-cachefiles-is-not-doing-ondemand-mode.patch +selftests-net-lib-update-busywait-timeout-value.patch +selftests-net-lib-no-need-to-record-ns-name-if-it-already-exist.patch +selftests-net-lib-support-errexit-with-busywait.patch +selftests-net-lib-avoid-error-removing-empty-netns-name.patch