From: Greg Kroah-Hartman Date: Tue, 4 Feb 2025 14:08:15 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v6.6.76~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d977cac46221b4cb233b02c971aa4c8f08b32e84;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch ktest.pl-check-kernelrelease-return-in-get_version.patch netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch usb-gadget-f_tcm-fix-get-setinterface-return-value.patch usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch --- diff --git a/queue-5.10/drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch b/queue-5.10/drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch new file mode 100644 index 0000000000..d3d02a870a --- /dev/null +++ b/queue-5.10/drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch @@ -0,0 +1,59 @@ +From 235b630eda072d7e7b102ab346d6b8a2c028a772 Mon Sep 17 00:00:00 2001 +From: Sean Rhodes +Date: Tue, 19 Nov 2024 08:58:15 +0000 +Subject: drivers/card_reader/rtsx_usb: Restore interrupt based detection + +From: Sean Rhodes + +commit 235b630eda072d7e7b102ab346d6b8a2c028a772 upstream. + +This commit reintroduces interrupt-based card detection previously +used in the rts5139 driver. This functionality was removed in commit +00d8521dcd23 ("staging: remove rts5139 driver code"). + +Reintroducing this mechanism fixes presence detection for certain card +readers, which with the current driver, will taken approximately 20 +seconds to enter S3 as `mmc_rescan` has to be frozen. + +Fixes: 00d8521dcd23 ("staging: remove rts5139 driver code") +Cc: stable@vger.kernel.org +Cc: Arnd Bergmann +Cc: Greg Kroah-Hartman +Signed-off-by: Sean Rhodes +Link: https://lore.kernel.org/r/20241119085815.11769-1-sean@starlabs.systems +Signed-off-by: Greg Kroah-Hartman +--- + drivers/misc/cardreader/rtsx_usb.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/misc/cardreader/rtsx_usb.c ++++ b/drivers/misc/cardreader/rtsx_usb.c +@@ -286,6 +286,7 @@ static int rtsx_usb_get_status_with_bulk + int rtsx_usb_get_card_status(struct rtsx_ucr *ucr, u16 *status) + { + int ret; ++ u8 interrupt_val = 0; + u16 *buf; + + if (!status) +@@ -308,6 +309,20 @@ int rtsx_usb_get_card_status(struct rtsx + ret = rtsx_usb_get_status_with_bulk(ucr, status); + } + ++ rtsx_usb_read_register(ucr, CARD_INT_PEND, &interrupt_val); ++ /* Cross check presence with interrupts */ ++ if (*status & XD_CD) ++ if (!(interrupt_val & XD_INT)) ++ *status &= ~XD_CD; ++ ++ if (*status & SD_CD) ++ if (!(interrupt_val & SD_INT)) ++ *status &= ~SD_CD; ++ ++ if (*status & MS_CD) ++ if (!(interrupt_val & MS_INT)) ++ *status &= ~MS_CD; ++ + /* usb_control_msg may return positive when success */ + if (ret < 0) + return ret; diff --git a/queue-5.10/ktest.pl-check-kernelrelease-return-in-get_version.patch b/queue-5.10/ktest.pl-check-kernelrelease-return-in-get_version.patch new file mode 100644 index 0000000000..8818d41419 --- /dev/null +++ b/queue-5.10/ktest.pl-check-kernelrelease-return-in-get_version.patch @@ -0,0 +1,40 @@ +From a4e17a8f239a545c463f8ec27db4ed6e74b31841 Mon Sep 17 00:00:00 2001 +From: "Ricardo B. Marliere" +Date: Thu, 5 Dec 2024 17:50:35 -0300 +Subject: ktest.pl: Check kernelrelease return in get_version + +From: Ricardo B. Marliere + +commit a4e17a8f239a545c463f8ec27db4ed6e74b31841 upstream. + +In the case of a test that uses the special option ${KERNEL_VERSION} in one +of its settings but has no configuration available in ${OUTPUT_DIR}, for +example if it's a new empty directory, then the `make kernelrelease` call +will fail and the subroutine will chomp an empty string, silently. Fix that +by adding an empty configuration and retrying. + +Cc: stable@vger.kernel.org +Cc: John Hawley +Fixes: 5f9b6ced04a4e ("ktest: Bisecting, install modules, add logging") +Link: https://lore.kernel.org/20241205-ktest_kver_fallback-v2-1-869dae4c7777@suse.com +Signed-off-by: Ricardo B. Marliere +Signed-off-by: Steven Rostedt +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/ktest/ktest.pl | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/tools/testing/ktest/ktest.pl ++++ b/tools/testing/ktest/ktest.pl +@@ -2350,6 +2350,11 @@ sub get_version { + return if ($have_version); + doprint "$make kernelrelease ... "; + $version = `$make -s kernelrelease | tail -1`; ++ if (!length($version)) { ++ run_command "$make allnoconfig" or return 0; ++ doprint "$make kernelrelease ... "; ++ $version = `$make -s kernelrelease | tail -1`; ++ } + chomp($version); + doprint "$version\n"; + $have_version = 1; diff --git a/queue-5.10/netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch b/queue-5.10/netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch new file mode 100644 index 0000000000..911a00fd52 --- /dev/null +++ b/queue-5.10/netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch @@ -0,0 +1,55 @@ +From 1b9335a8000fb70742f7db10af314104b6ace220 Mon Sep 17 00:00:00 2001 +From: Pablo Neira Ayuso +Date: Tue, 28 Jan 2025 12:26:33 +0100 +Subject: netfilter: nf_tables: reject mismatching sum of field_len with set key length + +From: Pablo Neira Ayuso + +commit 1b9335a8000fb70742f7db10af314104b6ace220 upstream. + +The field length description provides the length of each separated key +field in the concatenation, each field gets rounded up to 32-bits to +calculate the pipapo rule width from pipapo_init(). The set key length +provides the total size of the key aligned to 32-bits. + +Register-based arithmetics still allows for combining mismatching set +key length and field length description, eg. set key length 10 and field +description [ 5, 4 ] leading to pipapo width of 12. + +Cc: stable@vger.kernel.org +Fixes: 3ce67e3793f4 ("netfilter: nf_tables: do not allow mismatch field size and set key length") +Reported-by: Noam Rathaus +Reviewed-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Greg Kroah-Hartman +--- + net/netfilter/nf_tables_api.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -4346,7 +4346,7 @@ static int nft_set_desc_concat_parse(con + static int nft_set_desc_concat(struct nft_set_desc *desc, + const struct nlattr *nla) + { +- u32 num_regs = 0, key_num_regs = 0; ++ u32 len = 0, num_regs; + struct nlattr *attr; + int rem, err, i; + +@@ -4360,12 +4360,12 @@ static int nft_set_desc_concat(struct nf + } + + for (i = 0; i < desc->field_count; i++) +- num_regs += DIV_ROUND_UP(desc->field_len[i], sizeof(u32)); ++ len += round_up(desc->field_len[i], sizeof(u32)); + +- key_num_regs = DIV_ROUND_UP(desc->klen, sizeof(u32)); +- if (key_num_regs != num_regs) ++ if (len != desc->klen) + return -EINVAL; + ++ num_regs = DIV_ROUND_UP(desc->klen, sizeof(u32)); + if (num_regs > NFT_REG32_COUNT) + return -E2BIG; + diff --git a/queue-5.10/series b/queue-5.10/series index 7d93e88014..a2f591306d 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -126,3 +126,8 @@ genksyms-fix-memory-leak-when-the-same-symbol-is-rea.patch hexagon-fix-using-plain-integer-as-null-pointer-warn.patch hexagon-fix-unbalanced-spinlock-in-die.patch nfsd-reset-cb_seq_status-after-nfs4err_delay.patch +netfilter-nf_tables-reject-mismatching-sum-of-field_len-with-set-key-length.patch +ktest.pl-check-kernelrelease-return-in-get_version.patch +drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch +usb-gadget-f_tcm-fix-get-setinterface-return-value.patch +usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch diff --git a/queue-5.10/usb-gadget-f_tcm-fix-get-setinterface-return-value.patch b/queue-5.10/usb-gadget-f_tcm-fix-get-setinterface-return-value.patch new file mode 100644 index 0000000000..ee4abef629 --- /dev/null +++ b/queue-5.10/usb-gadget-f_tcm-fix-get-setinterface-return-value.patch @@ -0,0 +1,50 @@ +From 3b997089903b909684114aca6f79d683e5c64a0e Mon Sep 17 00:00:00 2001 +From: Thinh Nguyen +Date: Wed, 11 Dec 2024 00:31:55 +0000 +Subject: usb: gadget: f_tcm: Fix Get/SetInterface return value + +From: Thinh Nguyen + +commit 3b997089903b909684114aca6f79d683e5c64a0e upstream. + +Check to make sure that the GetInterface and SetInterface are for valid +interface. Return proper alternate setting number on GetInterface. + +Fixes: 0b8b1a1fede0 ("usb: gadget: f_tcm: Provide support to get alternate setting in tcm function") +Cc: stable@vger.kernel.org +Signed-off-by: Thinh Nguyen +Link: https://lore.kernel.org/r/ffd91b4640945ea4d3b4f4091cf1abbdbd9cf4fc.1733876548.git.Thinh.Nguyen@synopsys.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/function/f_tcm.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +--- a/drivers/usb/gadget/function/f_tcm.c ++++ b/drivers/usb/gadget/function/f_tcm.c +@@ -2102,9 +2102,14 @@ static void tcm_delayed_set_alt(struct w + + static int tcm_get_alt(struct usb_function *f, unsigned intf) + { +- if (intf == bot_intf_desc.bInterfaceNumber) ++ struct f_uas *fu = to_f_uas(f); ++ ++ if (fu->iface != intf) ++ return -EOPNOTSUPP; ++ ++ if (fu->flags & USBG_IS_BOT) + return USB_G_ALT_INT_BBB; +- if (intf == uasp_intf_desc.bInterfaceNumber) ++ else if (fu->flags & USBG_IS_UAS) + return USB_G_ALT_INT_UAS; + + return -EOPNOTSUPP; +@@ -2114,6 +2119,9 @@ static int tcm_set_alt(struct usb_functi + { + struct f_uas *fu = to_f_uas(f); + ++ if (fu->iface != intf) ++ return -EOPNOTSUPP; ++ + if ((alt == USB_G_ALT_INT_BBB) || (alt == USB_G_ALT_INT_UAS)) { + struct guas_setup_wq *work; + diff --git a/queue-5.10/usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch b/queue-5.10/usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch new file mode 100644 index 0000000000..35d76d54e2 --- /dev/null +++ b/queue-5.10/usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch @@ -0,0 +1,36 @@ +From 2eb3da037c2c20fa30bc502bc092479b2a1aaae2 Mon Sep 17 00:00:00 2001 +From: Jos Wang +Date: Sun, 5 Jan 2025 21:52:45 +0800 +Subject: usb: typec: tcpm: set SRC_SEND_CAPABILITIES timeout to PD_T_SENDER_RESPONSE + +From: Jos Wang + +commit 2eb3da037c2c20fa30bc502bc092479b2a1aaae2 upstream. + +As PD2.0 spec ("8.3.3.2.3 PE_SRC_Send_Capabilities state"), after the +Source receives the GoodCRC Message from the Sink in response to the +Source_Capabilities message, it should start the SenderResponseTimer, +after the timer times out, the state machine transitions to the +HARD_RESET state. + +Fixes: f0690a25a140 ("staging: typec: USB Type-C Port Manager (tcpm)") +Cc: stable@vger.kernel.org +Signed-off-by: Jos Wang +Reviewed-by: Badhri Jagan Sridharan +Link: https://lore.kernel.org/r/20250105135245.7493-1-joswang1221@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/typec/tcpm/tcpm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/typec/tcpm/tcpm.c ++++ b/drivers/usb/typec/tcpm/tcpm.c +@@ -3195,7 +3195,7 @@ static void run_state_machine(struct tcp + port->caps_count = 0; + port->pd_capable = true; + tcpm_set_state_cond(port, SRC_SEND_CAPABILITIES_TIMEOUT, +- PD_T_SEND_SOURCE_CAP); ++ PD_T_SENDER_RESPONSE); + } + break; + case SRC_SEND_CAPABILITIES_TIMEOUT: