From: Greg Kroah-Hartman Date: Fri, 19 Apr 2024 10:43:24 +0000 (+0200) Subject: 6.6-stable patches X-Git-Tag: v5.15.157~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a0bf2882c5fa4dc05750c17db72a0536644b7cf;p=thirdparty%2Fkernel%2Fstable-queue.git 6.6-stable patches added patches: net-usb-ax88179_178a-avoid-writing-the-mac-address-before-first-reading.patch random-handle-creditable-entropy-from-atomic-process-context.patch scsi-core-fix-handling-of-scmd_fail_if_recovering.patch selftests-ftrace-limit-length-in-subsystem-enable-tests.patch sunrpc-fix-rpcgss_context-trace-event-acceptor-field.patch --- diff --git a/queue-6.6/net-usb-ax88179_178a-avoid-writing-the-mac-address-before-first-reading.patch b/queue-6.6/net-usb-ax88179_178a-avoid-writing-the-mac-address-before-first-reading.patch new file mode 100644 index 00000000000..f8cb7c900d6 --- /dev/null +++ b/queue-6.6/net-usb-ax88179_178a-avoid-writing-the-mac-address-before-first-reading.patch @@ -0,0 +1,64 @@ +From 56f78615bcb1c3ba58a5d9911bad3d9185cf141b Mon Sep 17 00:00:00 2001 +From: Jose Ignacio Tornos Martinez +Date: Wed, 17 Apr 2024 10:55:13 +0200 +Subject: net: usb: ax88179_178a: avoid writing the mac address before first reading + +From: Jose Ignacio Tornos Martinez + +commit 56f78615bcb1c3ba58a5d9911bad3d9185cf141b upstream. + +After the commit d2689b6a86b9 ("net: usb: ax88179_178a: avoid two +consecutive device resets"), reset operation, in which the default mac +address from the device is read, is not executed from bind operation and +the random address, that is pregenerated just in case, is direclty written +the first time in the device, so the default one from the device is not +even read. This writing is not dangerous because is volatile and the +default mac address is not missed. + +In order to avoid this and keep the simplification to have only one +reset and reduce the delays, restore the reset from bind operation and +remove the reset that is commanded from open operation. The behavior is +the same but everything is ready for usbnet_probe. + +Tested with ASIX AX88179 USB Gigabit Ethernet devices. +Restore the old behavior for the rest of possible devices because I don't +have the hardware to test. + +cc: stable@vger.kernel.org # 6.6+ +Fixes: d2689b6a86b9 ("net: usb: ax88179_178a: avoid two consecutive device resets") +Reported-by: Jarkko Palviainen +Signed-off-by: Jose Ignacio Tornos Martinez +Link: https://lore.kernel.org/r/20240417085524.219532-1-jtornosm@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/ax88179_178a.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/net/usb/ax88179_178a.c ++++ b/drivers/net/usb/ax88179_178a.c +@@ -1317,6 +1317,8 @@ static int ax88179_bind(struct usbnet *d + + netif_set_tso_max_size(dev->net, 16384); + ++ ax88179_reset(dev); ++ + return 0; + } + +@@ -1695,7 +1697,6 @@ static const struct driver_info ax88179_ + .unbind = ax88179_unbind, + .status = ax88179_status, + .link_reset = ax88179_link_reset, +- .reset = ax88179_reset, + .stop = ax88179_stop, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, + .rx_fixup = ax88179_rx_fixup, +@@ -1708,7 +1709,6 @@ static const struct driver_info ax88178a + .unbind = ax88179_unbind, + .status = ax88179_status, + .link_reset = ax88179_link_reset, +- .reset = ax88179_reset, + .stop = ax88179_stop, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, + .rx_fixup = ax88179_rx_fixup, diff --git a/queue-6.6/random-handle-creditable-entropy-from-atomic-process-context.patch b/queue-6.6/random-handle-creditable-entropy-from-atomic-process-context.patch new file mode 100644 index 00000000000..a6b6dadbcfd --- /dev/null +++ b/queue-6.6/random-handle-creditable-entropy-from-atomic-process-context.patch @@ -0,0 +1,94 @@ +From e871abcda3b67d0820b4182ebe93435624e9c6a4 Mon Sep 17 00:00:00 2001 +From: "Jason A. Donenfeld" +Date: Wed, 17 Apr 2024 13:38:29 +0200 +Subject: random: handle creditable entropy from atomic process context + +From: Jason A. Donenfeld + +commit e871abcda3b67d0820b4182ebe93435624e9c6a4 upstream. + +The entropy accounting changes a static key when the RNG has +initialized, since it only ever initializes once. Static key changes, +however, cannot be made from atomic context, so depending on where the +last creditable entropy comes from, the static key change might need to +be deferred to a worker. + +Previously the code used the execute_in_process_context() helper +function, which accounts for whether or not the caller is +in_interrupt(). However, that doesn't account for the case where the +caller is actually in process context but is holding a spinlock. + +This turned out to be the case with input_handle_event() in +drivers/input/input.c contributing entropy: + + [] die+0xa8/0x2fc + [] bug_handler+0x44/0xec + [] brk_handler+0x90/0x144 + [] do_debug_exception+0xa0/0x148 + [] el1_dbg+0x60/0x7c + [] el1h_64_sync_handler+0x38/0x90 + [] el1h_64_sync+0x64/0x6c + [] __might_resched+0x1fc/0x2e8 + [] __might_sleep+0x44/0x7c + [] cpus_read_lock+0x1c/0xec + [] static_key_enable+0x14/0x38 + [] crng_set_ready+0x14/0x28 + [] execute_in_process_context+0xb8/0xf8 + [] _credit_init_bits+0x118/0x1dc + [] add_timer_randomness+0x264/0x270 + [] add_input_randomness+0x38/0x48 + [] input_handle_event+0x2b8/0x490 + [] input_event+0x6c/0x98 + +According to Guoyong, it's not really possible to refactor the various +drivers to never hold a spinlock there. And in_atomic() isn't reliable. + +So, rather than trying to be too fancy, just punt the change in the +static key to a workqueue always. There's basically no drawback of doing +this, as the code already needed to account for the static key not +changing immediately, and given that it's just an optimization, there's +not exactly a hurry to change the static key right away, so deferal is +fine. + +Reported-by: Guoyong Wang +Cc: stable@vger.kernel.org +Fixes: f5bda35fba61 ("random: use static branch for crng_ready()") +Signed-off-by: Jason A. Donenfeld +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/random.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/char/random.c ++++ b/drivers/char/random.c +@@ -702,7 +702,7 @@ static void extract_entropy(void *buf, s + + static void __cold _credit_init_bits(size_t bits) + { +- static struct execute_work set_ready; ++ static DECLARE_WORK(set_ready, crng_set_ready); + unsigned int new, orig, add; + unsigned long flags; + +@@ -718,8 +718,8 @@ static void __cold _credit_init_bits(siz + + if (orig < POOL_READY_BITS && new >= POOL_READY_BITS) { + crng_reseed(NULL); /* Sets crng_init to CRNG_READY under base_crng.lock. */ +- if (static_key_initialized) +- execute_in_process_context(crng_set_ready, &set_ready); ++ if (static_key_initialized && system_unbound_wq) ++ queue_work(system_unbound_wq, &set_ready); + atomic_notifier_call_chain(&random_ready_notifier, 0, NULL); + wake_up_interruptible(&crng_init_wait); + kill_fasync(&fasync, SIGIO, POLL_IN); +@@ -890,8 +890,8 @@ void __init random_init(void) + + /* + * If we were initialized by the cpu or bootloader before jump labels +- * are initialized, then we should enable the static branch here, where +- * it's guaranteed that jump labels have been initialized. ++ * or workqueues are initialized, then we should enable the static ++ * branch here, where it's guaranteed that these have been initialized. + */ + if (!static_branch_likely(&crng_is_ready) && crng_init >= CRNG_READY) + crng_set_ready(NULL); diff --git a/queue-6.6/scsi-core-fix-handling-of-scmd_fail_if_recovering.patch b/queue-6.6/scsi-core-fix-handling-of-scmd_fail_if_recovering.patch new file mode 100644 index 00000000000..e35a5fb2472 --- /dev/null +++ b/queue-6.6/scsi-core-fix-handling-of-scmd_fail_if_recovering.patch @@ -0,0 +1,40 @@ +From ca91259b775f6fd98ae5d23bb4eec101d468ba8d Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Mon, 25 Mar 2024 15:44:17 -0700 +Subject: scsi: core: Fix handling of SCMD_FAIL_IF_RECOVERING + +From: Bart Van Assche + +commit ca91259b775f6fd98ae5d23bb4eec101d468ba8d upstream. + +There is code in the SCSI core that sets the SCMD_FAIL_IF_RECOVERING +flag but there is no code that clears this flag. Instead of only clearing +SCMD_INITIALIZED in scsi_end_request(), clear all flags. It is never +necessary to preserve any command flags inside scsi_end_request(). + +Cc: stable@vger.kernel.org +Fixes: 310bcaef6d7e ("scsi: core: Support failing requests while recovering") +Signed-off-by: Bart Van Assche +Link: https://lore.kernel.org/r/20240325224417.1477135-1-bvanassche@acm.org +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/scsi/scsi_lib.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -543,10 +543,9 @@ static bool scsi_end_request(struct requ + if (blk_queue_add_random(q)) + add_disk_randomness(req->q->disk); + +- if (!blk_rq_is_passthrough(req)) { +- WARN_ON_ONCE(!(cmd->flags & SCMD_INITIALIZED)); +- cmd->flags &= ~SCMD_INITIALIZED; +- } ++ WARN_ON_ONCE(!blk_rq_is_passthrough(req) && ++ !(cmd->flags & SCMD_INITIALIZED)); ++ cmd->flags = 0; + + /* + * Calling rcu_barrier() is not necessary here because the diff --git a/queue-6.6/selftests-ftrace-limit-length-in-subsystem-enable-tests.patch b/queue-6.6/selftests-ftrace-limit-length-in-subsystem-enable-tests.patch new file mode 100644 index 00000000000..550d5e47bb3 --- /dev/null +++ b/queue-6.6/selftests-ftrace-limit-length-in-subsystem-enable-tests.patch @@ -0,0 +1,55 @@ +From 1a4ea83a6e67f1415a1f17c1af5e9c814c882bb5 Mon Sep 17 00:00:00 2001 +From: Yuanhe Shu +Date: Mon, 26 Feb 2024 11:18:16 +0800 +Subject: selftests/ftrace: Limit length in subsystem-enable tests + +From: Yuanhe Shu + +commit 1a4ea83a6e67f1415a1f17c1af5e9c814c882bb5 upstream. + +While sched* events being traced and sched* events continuously happen, +"[xx] event tracing - enable/disable with subsystem level files" would +not stop as on some slower systems it seems to take forever. +Select the first 100 lines of output would be enough to judge whether +there are more than 3 types of sched events. + +Fixes: 815b18ea66d6 ("ftracetest: Add basic event tracing test cases") +Cc: stable@vger.kernel.org +Signed-off-by: Yuanhe Shu +Acked-by: Masami Hiramatsu (Google) +Acked-by: Steven Rostedt (Google) +Signed-off-by: Shuah Khan +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc ++++ b/tools/testing/selftests/ftrace/test.d/event/subsystem-enable.tc +@@ -18,7 +18,7 @@ echo 'sched:*' > set_event + + yield + +-count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` ++count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` + if [ $count -lt 3 ]; then + fail "at least fork, exec and exit events should be recorded" + fi +@@ -29,7 +29,7 @@ echo 1 > events/sched/enable + + yield + +-count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` ++count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` + if [ $count -lt 3 ]; then + fail "at least fork, exec and exit events should be recorded" + fi +@@ -40,7 +40,7 @@ echo 0 > events/sched/enable + + yield + +-count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` ++count=`head -n 100 trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l` + if [ $count -ne 0 ]; then + fail "any of scheduler events should not be recorded" + fi diff --git a/queue-6.6/series b/queue-6.6/series index a8d99bcb255..5e10bc9cdee 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -22,3 +22,8 @@ drm-msm-dpu-populate-sspp-scaler-block-version.patch media-videobuf2-request-more-buffers-for-vb2_read.patch io_uring-fix-io_cqring_wait-not-restoring-sigmask-on-get_timespec64-failure.patch drm-i915-vma-fix-uaf-on-destroy-against-retire-race.patch +sunrpc-fix-rpcgss_context-trace-event-acceptor-field.patch +selftests-ftrace-limit-length-in-subsystem-enable-tests.patch +random-handle-creditable-entropy-from-atomic-process-context.patch +scsi-core-fix-handling-of-scmd_fail_if_recovering.patch +net-usb-ax88179_178a-avoid-writing-the-mac-address-before-first-reading.patch diff --git a/queue-6.6/sunrpc-fix-rpcgss_context-trace-event-acceptor-field.patch b/queue-6.6/sunrpc-fix-rpcgss_context-trace-event-acceptor-field.patch new file mode 100644 index 00000000000..dcbe6cd0fc5 --- /dev/null +++ b/queue-6.6/sunrpc-fix-rpcgss_context-trace-event-acceptor-field.patch @@ -0,0 +1,54 @@ +From a4833e3abae132d613ce7da0e0c9a9465d1681fa Mon Sep 17 00:00:00 2001 +From: "Steven Rostedt (Google)" +Date: Wed, 10 Apr 2024 12:38:13 -0400 +Subject: SUNRPC: Fix rpcgss_context trace event acceptor field + +From: Steven Rostedt (Google) + +commit a4833e3abae132d613ce7da0e0c9a9465d1681fa upstream. + +The rpcgss_context trace event acceptor field is a dynamically sized +string that records the "data" parameter. But this parameter is also +dependent on the "len" field to determine the size of the data. + +It needs to use __string_len() helper macro where the length can be passed +in. It also incorrectly uses strncpy() to save it instead of +__assign_str(). As these macros can change, it is not wise to open code +them in trace events. + +As of commit c759e609030c ("tracing: Remove __assign_str_len()"), +__assign_str() can be used for both __string() and __string_len() fields. +Before that commit, __assign_str_len() is required to be used. This needs +to be noted for backporting. (In actuality, commit c1fa617caeb0 ("tracing: +Rework __assign_str() and __string() to not duplicate getting the string") +is the commit that makes __string_str_len() obsolete). + +Cc: stable@vger.kernel.org +Fixes: 0c77668ddb4e ("SUNRPC: Introduce trace points in rpc_auth_gss.ko") +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Chuck Lever +Signed-off-by: Greg Kroah-Hartman +--- + include/trace/events/rpcgss.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/include/trace/events/rpcgss.h ++++ b/include/trace/events/rpcgss.h +@@ -609,7 +609,7 @@ TRACE_EVENT(rpcgss_context, + __field(unsigned int, timeout) + __field(u32, window_size) + __field(int, len) +- __string(acceptor, data) ++ __string_len(acceptor, data, len) + ), + + TP_fast_assign( +@@ -618,7 +618,7 @@ TRACE_EVENT(rpcgss_context, + __entry->timeout = timeout; + __entry->window_size = window_size; + __entry->len = len; +- strncpy(__get_str(acceptor), data, len); ++ __assign_str(acceptor, data); + ), + + TP_printk("win_size=%u expiry=%lu now=%lu timeout=%u acceptor=%.*s",