]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 May 2024 12:41:28 +0000 (14:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 May 2024 12:41:28 +0000 (14:41 +0200)
added patches:
admin-guide-hw-vuln-core-scheduling-fix-return-type-of-pr_sched_core_get.patch
binder-fix-max_thread-type-inconsistency.patch
docs-kernel_include.py-cope-with-docutils-0.21.patch
keys-trusted-do-not-use-warn-when-encode-fails.patch
net-usb-ax88179_178a-fix-link-status-when-link-is-set-to-down-up.patch
remoteproc-mediatek-make-sure-ipi-buffer-fits-in-l2tcm.patch
serial-kgdboc-fix-nmi-safety-problems-from-keyboard-reset-code.patch
usb-dwc3-wait-unconditionally-after-issuing-endxfer-command.patch
usb-typec-tipd-fix-event-checking-for-tps6598x.patch
usb-typec-ucsi-displayport-fix-potential-deadlock.patch

queue-6.1/admin-guide-hw-vuln-core-scheduling-fix-return-type-of-pr_sched_core_get.patch [new file with mode: 0644]
queue-6.1/binder-fix-max_thread-type-inconsistency.patch [new file with mode: 0644]
queue-6.1/docs-kernel_include.py-cope-with-docutils-0.21.patch [new file with mode: 0644]
queue-6.1/keys-trusted-do-not-use-warn-when-encode-fails.patch [new file with mode: 0644]
queue-6.1/net-usb-ax88179_178a-fix-link-status-when-link-is-set-to-down-up.patch [new file with mode: 0644]
queue-6.1/remoteproc-mediatek-make-sure-ipi-buffer-fits-in-l2tcm.patch [new file with mode: 0644]
queue-6.1/serial-kgdboc-fix-nmi-safety-problems-from-keyboard-reset-code.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/usb-dwc3-wait-unconditionally-after-issuing-endxfer-command.patch [new file with mode: 0644]
queue-6.1/usb-typec-tipd-fix-event-checking-for-tps6598x.patch [new file with mode: 0644]
queue-6.1/usb-typec-ucsi-displayport-fix-potential-deadlock.patch [new file with mode: 0644]

diff --git a/queue-6.1/admin-guide-hw-vuln-core-scheduling-fix-return-type-of-pr_sched_core_get.patch b/queue-6.1/admin-guide-hw-vuln-core-scheduling-fix-return-type-of-pr_sched_core_get.patch
new file mode 100644 (file)
index 0000000..32ec6c7
--- /dev/null
@@ -0,0 +1,47 @@
+From 8af2d1ab78f2342f8c4c3740ca02d86f0ebfac5a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= <linux@weissschuh.net>
+Date: Tue, 23 Apr 2024 12:34:25 +0200
+Subject: admin-guide/hw-vuln/core-scheduling: fix return type of PR_SCHED_CORE_GET
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thomas Weißschuh <linux@weissschuh.net>
+
+commit 8af2d1ab78f2342f8c4c3740ca02d86f0ebfac5a upstream.
+
+sched_core_share_pid() copies the cookie to userspace with
+put_user(id, (u64 __user *)uaddr), expecting 64 bits of space.
+The "unsigned long" datatype that is documented in core-scheduling.rst
+however is only 32 bits large on 32 bit architectures.
+
+Document "unsigned long long" as the correct data type that is always
+64bits large.
+
+This matches what the selftest cs_prctl_test.c has been doing all along.
+
+Fixes: 0159bb020ca9 ("Documentation: Add usecases, design and interface for core scheduling")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/util-linux/df7a25a0-7923-4f8b-a527-5e6f0064074d@t-8ch.de/
+Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
+Reviewed-by: Chris Hyser <chris.hyser@oracle.com>
+Signed-off-by: Jonathan Corbet <corbet@lwn.net>
+Link: https://lore.kernel.org/r/20240423-core-scheduling-cookie-v1-1-5753a35f8dfc@weissschuh.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/admin-guide/hw-vuln/core-scheduling.rst |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/Documentation/admin-guide/hw-vuln/core-scheduling.rst
++++ b/Documentation/admin-guide/hw-vuln/core-scheduling.rst
+@@ -67,8 +67,8 @@ arg4:
+     will be performed for all tasks in the task group of ``pid``.
+ arg5:
+-    userspace pointer to an unsigned long for storing the cookie returned by
+-    ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
++    userspace pointer to an unsigned long long for storing the cookie returned
++    by ``PR_SCHED_CORE_GET`` command. Should be 0 for all other commands.
+ In order for a process to push a cookie to, or pull a cookie from a process, it
+ is required to have the ptrace access mode: `PTRACE_MODE_READ_REALCREDS` to the
diff --git a/queue-6.1/binder-fix-max_thread-type-inconsistency.patch b/queue-6.1/binder-fix-max_thread-type-inconsistency.patch
new file mode 100644 (file)
index 0000000..f6c3a24
--- /dev/null
@@ -0,0 +1,51 @@
+From 42316941335644a98335f209daafa4c122f28983 Mon Sep 17 00:00:00 2001
+From: Carlos Llamas <cmllamas@google.com>
+Date: Sun, 21 Apr 2024 17:37:49 +0000
+Subject: binder: fix max_thread type inconsistency
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Carlos Llamas <cmllamas@google.com>
+
+commit 42316941335644a98335f209daafa4c122f28983 upstream.
+
+The type defined for the BINDER_SET_MAX_THREADS ioctl was changed from
+size_t to __u32 in order to avoid incompatibility issues between 32 and
+64-bit kernels. However, the internal types used to copy from user and
+store the value were never updated. Use u32 to fix the inconsistency.
+
+Fixes: a9350fc859ae ("staging: android: binder: fix BINDER_SET_MAX_THREADS declaration")
+Reported-by: Arve Hjønnevåg <arve@android.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Carlos Llamas <cmllamas@google.com>
+Reviewed-by: Alice Ryhl <aliceryhl@google.com>
+Link: https://lore.kernel.org/r/20240421173750.3117808-1-cmllamas@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/android/binder.c          |    2 +-
+ drivers/android/binder_internal.h |    2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/android/binder.c
++++ b/drivers/android/binder.c
+@@ -5350,7 +5350,7 @@ static long binder_ioctl(struct file *fi
+                       goto err;
+               break;
+       case BINDER_SET_MAX_THREADS: {
+-              int max_threads;
++              u32 max_threads;
+               if (copy_from_user(&max_threads, ubuf,
+                                  sizeof(max_threads))) {
+--- a/drivers/android/binder_internal.h
++++ b/drivers/android/binder_internal.h
+@@ -420,7 +420,7 @@ struct binder_proc {
+       struct list_head todo;
+       struct binder_stats stats;
+       struct list_head delivered_death;
+-      int max_threads;
++      u32 max_threads;
+       int requested_threads;
+       int requested_threads_started;
+       int tmp_ref;
diff --git a/queue-6.1/docs-kernel_include.py-cope-with-docutils-0.21.patch b/queue-6.1/docs-kernel_include.py-cope-with-docutils-0.21.patch
new file mode 100644 (file)
index 0000000..f055827
--- /dev/null
@@ -0,0 +1,66 @@
+From d43ddd5c91802a46354fa4c4381416ef760676e2 Mon Sep 17 00:00:00 2001
+From: Akira Yokosawa <akiyks@gmail.com>
+Date: Wed, 1 May 2024 12:16:11 +0900
+Subject: docs: kernel_include.py: Cope with docutils 0.21
+
+From: Akira Yokosawa <akiyks@gmail.com>
+
+commit d43ddd5c91802a46354fa4c4381416ef760676e2 upstream.
+
+Running "make htmldocs" on a newly installed Sphinx 7.3.7 ends up in
+a build error:
+
+    Sphinx parallel build error:
+    AttributeError: module 'docutils.nodes' has no attribute 'reprunicode'
+
+docutils 0.21 has removed nodes.reprunicode, quote from release note [1]:
+
+  * Removed objects:
+
+    docutils.nodes.reprunicode, docutils.nodes.ensure_str()
+        Python 2 compatibility hacks
+
+Sphinx 7.3.0 supports docutils 0.21 [2]:
+
+kernel_include.py, whose origin is misc.py of docutils, uses reprunicode.
+
+Upstream docutils removed the offending line from the corresponding file
+(docutils/docutils/parsers/rst/directives/misc.py) in January 2022.
+Quoting the changelog [3]:
+
+    Deprecate `nodes.reprunicode` and `nodes.ensure_str()`.
+
+    Drop uses of the deprecated constructs (not required with Python 3).
+
+Do the same for kernel_include.py.
+
+Tested against:
+  - Sphinx 2.4.5 (docutils 0.17.1)
+  - Sphinx 3.4.3 (docutils 0.17.1)
+  - Sphinx 5.3.0 (docutils 0.18.1)
+  - Sphinx 6.2.1 (docutils 0.19)
+  - Sphinx 7.2.6 (docutils 0.20.1)
+  - Sphinx 7.3.7 (docutils 0.21.2)
+
+Link: http://www.docutils.org/RELEASE-NOTES.html#release-0-21-2024-04-09 [1]
+Link: https://www.sphinx-doc.org/en/master/changes.html#release-7-3-0-released-apr-16-2024 [2]
+Link: https://github.com/docutils/docutils/commit/c8471ce47a24 [3]
+Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Jonathan Corbet <corbet@lwn.net>
+Link: https://lore.kernel.org/r/faf5fa45-2a9d-4573-9d2e-3930bdc1ed65@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ Documentation/sphinx/kernel_include.py |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/Documentation/sphinx/kernel_include.py
++++ b/Documentation/sphinx/kernel_include.py
+@@ -97,7 +97,6 @@ class KernelInclude(Include):
+         # HINT: this is the only line I had to change / commented out:
+         #path = utils.relative_path(None, path)
+-        path = nodes.reprunicode(path)
+         encoding = self.options.get(
+             'encoding', self.state.document.settings.input_encoding)
+         e_handler=self.state.document.settings.input_encoding_error_handler
diff --git a/queue-6.1/keys-trusted-do-not-use-warn-when-encode-fails.patch b/queue-6.1/keys-trusted-do-not-use-warn-when-encode-fails.patch
new file mode 100644 (file)
index 0000000..1a75425
--- /dev/null
@@ -0,0 +1,44 @@
+From 050bf3c793a07f96bd1e2fd62e1447f731ed733b Mon Sep 17 00:00:00 2001
+From: Jarkko Sakkinen <jarkko@kernel.org>
+Date: Mon, 13 May 2024 21:19:04 +0300
+Subject: KEYS: trusted: Do not use WARN when encode fails
+
+From: Jarkko Sakkinen <jarkko@kernel.org>
+
+commit 050bf3c793a07f96bd1e2fd62e1447f731ed733b upstream.
+
+When asn1_encode_sequence() fails, WARN is not the correct solution.
+
+1. asn1_encode_sequence() is not an internal function (located
+   in lib/asn1_encode.c).
+2. Location is known, which makes the stack trace useless.
+3. Results a crash if panic_on_warn is set.
+
+It is also noteworthy that the use of WARN is undocumented, and it
+should be avoided unless there is a carefully considered rationale to
+use it.
+
+Replace WARN with pr_err, and print the return value instead, which is
+only useful piece of information.
+
+Cc: stable@vger.kernel.org # v5.13+
+Fixes: f2219745250f ("security: keys: trusted: use ASN.1 TPM2 key format for the blobs")
+Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ security/keys/trusted-keys/trusted_tpm2.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/security/keys/trusted-keys/trusted_tpm2.c
++++ b/security/keys/trusted-keys/trusted_tpm2.c
+@@ -84,8 +84,9 @@ static int tpm2_key_encode(struct truste
+       work1 = payload->blob;
+       work1 = asn1_encode_sequence(work1, work1 + sizeof(payload->blob),
+                                    scratch, work - scratch);
+-      if (WARN(IS_ERR(work1), "BUG: ASN.1 encoder failed")) {
++      if (IS_ERR(work1)) {
+               ret = PTR_ERR(work1);
++              pr_err("BUG: ASN.1 encoder failed with %d\n", ret);
+               goto err;
+       }
diff --git a/queue-6.1/net-usb-ax88179_178a-fix-link-status-when-link-is-set-to-down-up.patch b/queue-6.1/net-usb-ax88179_178a-fix-link-status-when-link-is-set-to-down-up.patch
new file mode 100644 (file)
index 0000000..61122a2
--- /dev/null
@@ -0,0 +1,181 @@
+From ecf848eb934b03959918f5269f64c0e52bc23998 Mon Sep 17 00:00:00 2001
+From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+Date: Fri, 10 May 2024 11:08:28 +0200
+Subject: net: usb: ax88179_178a: fix link status when link is set to down/up
+
+From: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+
+commit ecf848eb934b03959918f5269f64c0e52bc23998 upstream.
+
+The idea was to keep only one reset at initialization stage in order to
+reduce the total delay, or the reset from usbnet_probe or the reset from
+usbnet_open.
+
+I have seen that restarting from usbnet_probe is necessary to avoid doing
+too complex things. But when the link is set to down/up (for example to
+configure a different mac address) the link is not correctly recovered
+unless a reset is commanded from usbnet_open.
+
+So, detect the initialization stage (first call) to not reset from
+usbnet_open after the reset from usbnet_probe and after this stage, always
+reset from usbnet_open too (when the link needs to be rechecked).
+
+Apply to all the possible devices, the behavior now is going to be the same.
+
+cc: stable@vger.kernel.org # 6.6+
+Fixes: 56f78615bcb1 ("net: usb: ax88179_178a: avoid writing the mac address before first reading")
+Reported-by: Isaac Ganoung <inventor500@vivaldi.net>
+Reported-by: Yongqin Liu <yongqin.liu@linaro.org>
+Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Link: https://lore.kernel.org/r/20240510090846.328201-1-jtornosm@redhat.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/ax88179_178a.c |   37 ++++++++++++++++++++++++++-----------
+ 1 file changed, 26 insertions(+), 11 deletions(-)
+
+--- a/drivers/net/usb/ax88179_178a.c
++++ b/drivers/net/usb/ax88179_178a.c
+@@ -174,6 +174,7 @@ struct ax88179_data {
+       u32 wol_supported;
+       u32 wolopts;
+       u8 disconnecting;
++      u8 initialized;
+ };
+ struct ax88179_int_data {
+@@ -1673,6 +1674,18 @@ static int ax88179_reset(struct usbnet *
+       return 0;
+ }
++static int ax88179_net_reset(struct usbnet *dev)
++{
++      struct ax88179_data *ax179_data = dev->driver_priv;
++
++      if (ax179_data->initialized)
++              ax88179_reset(dev);
++      else
++              ax179_data->initialized = 1;
++
++      return 0;
++}
++
+ static int ax88179_stop(struct usbnet *dev)
+ {
+       u16 tmp16;
+@@ -1692,6 +1705,7 @@ static const struct driver_info ax88179_
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1704,6 +1718,7 @@ static const struct driver_info ax88178a
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1716,7 +1731,7 @@ static const struct driver_info cypress_
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset = ax88179_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1729,7 +1744,7 @@ static const struct driver_info dlink_du
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset = ax88179_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1742,7 +1757,7 @@ static const struct driver_info sitecom_
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset = ax88179_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1755,7 +1770,7 @@ static const struct driver_info samsung_
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset = ax88179_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1768,7 +1783,7 @@ static const struct driver_info lenovo_i
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset = ax88179_reset,
++      .reset = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1781,7 +1796,7 @@ static const struct driver_info belkin_i
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset  = ax88179_reset,
++      .reset  = ax88179_net_reset,
+       .stop   = ax88179_stop,
+       .flags  = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1794,7 +1809,7 @@ static const struct driver_info toshiba_
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset  = ax88179_reset,
++      .reset  = ax88179_net_reset,
+       .stop = ax88179_stop,
+       .flags  = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1807,7 +1822,7 @@ static const struct driver_info mct_info
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset  = ax88179_reset,
++      .reset  = ax88179_net_reset,
+       .stop   = ax88179_stop,
+       .flags  = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1820,7 +1835,7 @@ static const struct driver_info at_umc20
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset  = ax88179_reset,
++      .reset  = ax88179_net_reset,
+       .stop   = ax88179_stop,
+       .flags  = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1833,7 +1848,7 @@ static const struct driver_info at_umc20
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset  = ax88179_reset,
++      .reset  = ax88179_net_reset,
+       .stop   = ax88179_stop,
+       .flags  = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
+@@ -1846,7 +1861,7 @@ static const struct driver_info at_umc20
+       .unbind = ax88179_unbind,
+       .status = ax88179_status,
+       .link_reset = ax88179_link_reset,
+-      .reset  = ax88179_reset,
++      .reset  = ax88179_net_reset,
+       .stop   = ax88179_stop,
+       .flags  = FLAG_ETHER | FLAG_FRAMING_AX,
+       .rx_fixup = ax88179_rx_fixup,
diff --git a/queue-6.1/remoteproc-mediatek-make-sure-ipi-buffer-fits-in-l2tcm.patch b/queue-6.1/remoteproc-mediatek-make-sure-ipi-buffer-fits-in-l2tcm.patch
new file mode 100644 (file)
index 0000000..9e014fa
--- /dev/null
@@ -0,0 +1,59 @@
+From 331f91d86f71d0bb89a44217cc0b2a22810bbd42 Mon Sep 17 00:00:00 2001
+From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Date: Thu, 21 Mar 2024 09:46:13 +0100
+Subject: remoteproc: mediatek: Make sure IPI buffer fits in L2TCM
+
+From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+
+commit 331f91d86f71d0bb89a44217cc0b2a22810bbd42 upstream.
+
+The IPI buffer location is read from the firmware that we load to the
+System Companion Processor, and it's not granted that both the SRAM
+(L2TCM) size that is defined in the devicetree node is large enough
+for that, and while this is especially true for multi-core SCP, it's
+still useful to check on single-core variants as well.
+
+Failing to perform this check may make this driver perform R/W
+operations out of the L2TCM boundary, resulting (at best) in a
+kernel panic.
+
+To fix that, check that the IPI buffer fits, otherwise return a
+failure and refuse to boot the relevant SCP core (or the SCP at
+all, if this is single core).
+
+Fixes: 3efa0ea743b7 ("remoteproc/mediatek: read IPI buffer offset from FW")
+Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240321084614.45253-2-angelogioacchino.delregno@collabora.com
+Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/remoteproc/mtk_scp.c |   10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+--- a/drivers/remoteproc/mtk_scp.c
++++ b/drivers/remoteproc/mtk_scp.c
+@@ -126,7 +126,7 @@ static int scp_elf_read_ipi_buf_addr(str
+ static int scp_ipi_init(struct mtk_scp *scp, const struct firmware *fw)
+ {
+       int ret;
+-      size_t offset;
++      size_t buf_sz, offset;
+       /* read the ipi buf addr from FW itself first */
+       ret = scp_elf_read_ipi_buf_addr(scp, fw, &offset);
+@@ -138,6 +138,14 @@ static int scp_ipi_init(struct mtk_scp *
+       }
+       dev_info(scp->dev, "IPI buf addr %#010zx\n", offset);
++      /* Make sure IPI buffer fits in the L2TCM range assigned to this core */
++      buf_sz = sizeof(*scp->recv_buf) + sizeof(*scp->send_buf);
++
++      if (scp->sram_size < buf_sz + offset) {
++              dev_err(scp->dev, "IPI buffer does not fit in SRAM.\n");
++              return -EOVERFLOW;
++      }
++
+       scp->recv_buf = (struct mtk_share_obj __iomem *)
+                       (scp->sram_base + offset);
+       scp->send_buf = (struct mtk_share_obj __iomem *)
diff --git a/queue-6.1/serial-kgdboc-fix-nmi-safety-problems-from-keyboard-reset-code.patch b/queue-6.1/serial-kgdboc-fix-nmi-safety-problems-from-keyboard-reset-code.patch
new file mode 100644 (file)
index 0000000..2328258
--- /dev/null
@@ -0,0 +1,95 @@
+From b2aba15ad6f908d1a620fd97f6af5620c3639742 Mon Sep 17 00:00:00 2001
+From: Daniel Thompson <daniel.thompson@linaro.org>
+Date: Wed, 24 Apr 2024 15:21:41 +0100
+Subject: serial: kgdboc: Fix NMI-safety problems from keyboard reset code
+
+From: Daniel Thompson <daniel.thompson@linaro.org>
+
+commit b2aba15ad6f908d1a620fd97f6af5620c3639742 upstream.
+
+Currently, when kdb is compiled with keyboard support, then we will use
+schedule_work() to provoke reset of the keyboard status.  Unfortunately
+schedule_work() gets called from the kgdboc post-debug-exception
+handler.  That risks deadlock since schedule_work() is not NMI-safe and,
+even on platforms where the NMI is not directly used for debugging, the
+debug trap can have NMI-like behaviour depending on where breakpoints
+are placed.
+
+Fix this by using the irq work system, which is NMI-safe, to defer the
+call to schedule_work() to a point when it is safe to call.
+
+Reported-by: Liuye <liu.yeC@h3c.com>
+Closes: https://lore.kernel.org/all/20240228025602.3087748-1-liu.yeC@h3c.com/
+Cc: stable@vger.kernel.org
+Reviewed-by: Douglas Anderson <dianders@chromium.org>
+Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Link: https://lore.kernel.org/r/20240424-kgdboc_fix_schedule_work-v2-1-50f5a490aec5@linaro.org
+Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/kgdboc.c |   30 +++++++++++++++++++++++++++++-
+ 1 file changed, 29 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/serial/kgdboc.c
++++ b/drivers/tty/serial/kgdboc.c
+@@ -19,6 +19,7 @@
+ #include <linux/console.h>
+ #include <linux/vt_kern.h>
+ #include <linux/input.h>
++#include <linux/irq_work.h>
+ #include <linux/module.h>
+ #include <linux/platform_device.h>
+ #include <linux/serial_core.h>
+@@ -48,6 +49,25 @@ static struct kgdb_io               kgdboc_earlycon_i
+ static int                      (*earlycon_orig_exit)(struct console *con);
+ #endif /* IS_BUILTIN(CONFIG_KGDB_SERIAL_CONSOLE) */
++/*
++ * When we leave the debug trap handler we need to reset the keyboard status
++ * (since the original keyboard state gets partially clobbered by kdb use of
++ * the keyboard).
++ *
++ * The path to deliver the reset is somewhat circuitous.
++ *
++ * To deliver the reset we register an input handler, reset the keyboard and
++ * then deregister the input handler. However, to get this done right, we do
++ * have to carefully manage the calling context because we can only register
++ * input handlers from task context.
++ *
++ * In particular we need to trigger the action from the debug trap handler with
++ * all its NMI and/or NMI-like oddities. To solve this the kgdboc trap exit code
++ * (the "post_exception" callback) uses irq_work_queue(), which is NMI-safe, to
++ * schedule a callback from a hardirq context. From there we have to defer the
++ * work again, this time using schedule_work(), to get a callback using the
++ * system workqueue, which runs in task context.
++ */
+ #ifdef CONFIG_KDB_KEYBOARD
+ static int kgdboc_reset_connect(struct input_handler *handler,
+                               struct input_dev *dev,
+@@ -99,10 +119,17 @@ static void kgdboc_restore_input_helper(
+ static DECLARE_WORK(kgdboc_restore_input_work, kgdboc_restore_input_helper);
++static void kgdboc_queue_restore_input_helper(struct irq_work *unused)
++{
++      schedule_work(&kgdboc_restore_input_work);
++}
++
++static DEFINE_IRQ_WORK(kgdboc_restore_input_irq_work, kgdboc_queue_restore_input_helper);
++
+ static void kgdboc_restore_input(void)
+ {
+       if (likely(system_state == SYSTEM_RUNNING))
+-              schedule_work(&kgdboc_restore_input_work);
++              irq_work_queue(&kgdboc_restore_input_irq_work);
+ }
+ static int kgdboc_register_kbd(char **cptr)
+@@ -133,6 +160,7 @@ static void kgdboc_unregister_kbd(void)
+                       i--;
+               }
+       }
++      irq_work_sync(&kgdboc_restore_input_irq_work);
+       flush_work(&kgdboc_restore_input_work);
+ }
+ #else /* ! CONFIG_KDB_KEYBOARD */
index ece6675853c02a845715019b573a83ae9ee5e8ea..66d6dd2a600b32ad13a3c064f0888bc249d73781 100644 (file)
@@ -33,3 +33,13 @@ xfs-get-root-inode-correctly-at-bulkstat.patch
 xfs-short-circuit-xfs_growfs_data_private-if-delta-is-zero.patch
 arm64-atomics-lse-remove-stale-dependency-on-jump_label.patch
 drm-amdgpu-fix-possible-null-dereference-in-amdgpu_ras_query_error_status_helper.patch
+binder-fix-max_thread-type-inconsistency.patch
+usb-dwc3-wait-unconditionally-after-issuing-endxfer-command.patch
+net-usb-ax88179_178a-fix-link-status-when-link-is-set-to-down-up.patch
+usb-typec-ucsi-displayport-fix-potential-deadlock.patch
+usb-typec-tipd-fix-event-checking-for-tps6598x.patch
+serial-kgdboc-fix-nmi-safety-problems-from-keyboard-reset-code.patch
+remoteproc-mediatek-make-sure-ipi-buffer-fits-in-l2tcm.patch
+keys-trusted-do-not-use-warn-when-encode-fails.patch
+admin-guide-hw-vuln-core-scheduling-fix-return-type-of-pr_sched_core_get.patch
+docs-kernel_include.py-cope-with-docutils-0.21.patch
diff --git a/queue-6.1/usb-dwc3-wait-unconditionally-after-issuing-endxfer-command.patch b/queue-6.1/usb-dwc3-wait-unconditionally-after-issuing-endxfer-command.patch
new file mode 100644 (file)
index 0000000..459c1ca
--- /dev/null
@@ -0,0 +1,58 @@
+From 1d26ba0944d398f88aaf997bda3544646cf21945 Mon Sep 17 00:00:00 2001
+From: Prashanth K <quic_prashk@quicinc.com>
+Date: Thu, 2 May 2024 10:11:03 +0530
+Subject: usb: dwc3: Wait unconditionally after issuing EndXfer command
+
+From: Prashanth K <quic_prashk@quicinc.com>
+
+commit 1d26ba0944d398f88aaf997bda3544646cf21945 upstream.
+
+Currently all controller IP/revisions except DWC3_usb3 >= 310a
+wait 1ms unconditionally for ENDXFER completion when IOC is not
+set. This is because DWC_usb3 controller revisions >= 3.10a
+supports GUCTL2[14: Rst_actbitlater] bit which allows polling
+CMDACT bit to know whether ENDXFER command is completed.
+
+Consider a case where an IN request was queued, and parallelly
+soft_disconnect was called (due to ffs_epfile_release). This
+eventually calls stop_active_transfer with IOC cleared, hence
+send_gadget_ep_cmd() skips waiting for CMDACT cleared during
+EndXfer. For DWC3 controllers with revisions >= 310a, we don't
+forcefully wait for 1ms either, and we proceed by unmapping the
+requests. If ENDXFER didn't complete by this time, it leads to
+SMMU faults since the controller would still be accessing those
+requests.
+
+Fix this by ensuring ENDXFER completion by adding 1ms delay in
+__dwc3_stop_active_transfer() unconditionally.
+
+Cc: stable@vger.kernel.org
+Fixes: b353eb6dc285 ("usb: dwc3: gadget: Skip waiting for CMDACT cleared during endxfer")
+Signed-off-by: Prashanth K <quic_prashk@quicinc.com>
+Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
+Link: https://lore.kernel.org/r/20240502044103.1066350-1-quic_prashk@quicinc.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/dwc3/gadget.c |    4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+--- a/drivers/usb/dwc3/gadget.c
++++ b/drivers/usb/dwc3/gadget.c
+@@ -1708,7 +1708,6 @@ static int __dwc3_gadget_get_frame(struc
+  */
+ static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool interrupt)
+ {
+-      struct dwc3 *dwc = dep->dwc;
+       struct dwc3_gadget_ep_cmd_params params;
+       u32 cmd;
+       int ret;
+@@ -1733,8 +1732,7 @@ static int __dwc3_stop_active_transfer(s
+       dep->resource_index = 0;
+       if (!interrupt) {
+-              if (!DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC3, 310A))
+-                      mdelay(1);
++              mdelay(1);
+               dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
+       } else if (!ret) {
+               dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
diff --git a/queue-6.1/usb-typec-tipd-fix-event-checking-for-tps6598x.patch b/queue-6.1/usb-typec-tipd-fix-event-checking-for-tps6598x.patch
new file mode 100644 (file)
index 0000000..08fe370
--- /dev/null
@@ -0,0 +1,148 @@
+From 409c1cfb5a803f3cf2d17aeaf75c25c4be951b07 Mon Sep 17 00:00:00 2001
+From: Javier Carrasco <javier.carrasco@wolfvision.net>
+Date: Mon, 29 Apr 2024 15:35:58 +0200
+Subject: usb: typec: tipd: fix event checking for tps6598x
+
+From: Javier Carrasco <javier.carrasco@wolfvision.net>
+
+commit 409c1cfb5a803f3cf2d17aeaf75c25c4be951b07 upstream.
+
+The current interrupt service routine of the tps6598x only reads the
+first 64 bits of the INT_EVENT1 and INT_EVENT2 registers, which means
+that any event above that range will be ignored, leaving interrupts
+unattended. Moreover, those events will not be cleared, and the device
+will keep the interrupt enabled.
+
+This issue has been observed while attempting to load patches, and the
+'ReadyForPatch' field (bit 81) of INT_EVENT1 was set.
+
+Given that older versions of the tps6598x (1, 2 and 6) provide 8-byte
+registers, a mechanism based on the upper byte of the version register
+(0x0F) has been included. The manufacturer has confirmed [1] that this
+byte is always 0 for older versions, and either 0xF7 (DH parts) or 0xF9
+(DK parts) is returned in newer versions (7 and 8).
+
+Read the complete INT_EVENT registers to handle all interrupts generated
+by the device and account for the hardware version to select the
+register size.
+
+Link: https://e2e.ti.com/support/power-management-group/power-management/f/power-management-forum/1346521/tps65987d-register-command-to-distinguish-between-tps6591-2-6-and-tps65987-8 [1]
+Fixes: 0a4c005bd171 ("usb: typec: driver for TI TPS6598x USB Power Delivery controllers")
+Cc: stable@vger.kernel.org
+Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net>
+Link: https://lore.kernel.org/r/20240429-tps6598x_fix_event_handling-v3-2-4e8e58dce489@wolfvision.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/tipd/core.c     |   45 +++++++++++++++++++++++++++-----------
+ drivers/usb/typec/tipd/tps6598x.h |   11 +++++++++
+ 2 files changed, 43 insertions(+), 13 deletions(-)
+
+--- a/drivers/usb/typec/tipd/core.c
++++ b/drivers/usb/typec/tipd/core.c
+@@ -24,6 +24,7 @@
+ #define TPS_REG_MODE                  0x03
+ #define TPS_REG_CMD1                  0x08
+ #define TPS_REG_DATA1                 0x09
++#define TPS_REG_VERSION                       0x0F
+ #define TPS_REG_INT_EVENT1            0x14
+ #define TPS_REG_INT_EVENT2            0x15
+ #define TPS_REG_INT_MASK1             0x16
+@@ -518,49 +519,67 @@ err_unlock:
+ static irqreturn_t tps6598x_interrupt(int irq, void *data)
+ {
++      int intev_len = TPS_65981_2_6_INTEVENT_LEN;
+       struct tps6598x *tps = data;
+-      u64 event1 = 0;
+-      u64 event2 = 0;
++      u64 event1[2] = { };
++      u64 event2[2] = { };
++      u32 version;
+       u32 status;
+       int ret;
+       mutex_lock(&tps->lock);
+-      ret = tps6598x_read64(tps, TPS_REG_INT_EVENT1, &event1);
+-      ret |= tps6598x_read64(tps, TPS_REG_INT_EVENT2, &event2);
++      ret = tps6598x_read32(tps, TPS_REG_VERSION, &version);
++      if (ret)
++              dev_warn(tps->dev, "%s: failed to read version (%d)\n",
++                       __func__, ret);
++
++      if (TPS_VERSION_HW_VERSION(version) == TPS_VERSION_HW_65987_8_DH ||
++          TPS_VERSION_HW_VERSION(version) == TPS_VERSION_HW_65987_8_DK)
++              intev_len = TPS_65987_8_INTEVENT_LEN;
++
++      ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
++
++      ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT1, event1, intev_len);
+       if (ret) {
+-              dev_err(tps->dev, "%s: failed to read events\n", __func__);
++              dev_err(tps->dev, "%s: failed to read event1\n", __func__);
+               goto err_unlock;
+       }
+-      trace_tps6598x_irq(event1, event2);
++      ret = tps6598x_block_read(tps, TPS_REG_INT_EVENT2, event2, intev_len);
++      if (ret) {
++              dev_err(tps->dev, "%s: failed to read event2\n", __func__);
++              goto err_unlock;
++      }
++      trace_tps6598x_irq(event1[0], event2[0]);
+-      if (!(event1 | event2))
++      if (!(event1[0] | event1[1] | event2[0] | event2[1]))
+               goto err_unlock;
+       if (!tps6598x_read_status(tps, &status))
+               goto err_clear_ints;
+-      if ((event1 | event2) & TPS_REG_INT_POWER_STATUS_UPDATE)
++      if ((event1[0] | event2[0]) & TPS_REG_INT_POWER_STATUS_UPDATE)
+               if (!tps6598x_read_power_status(tps))
+                       goto err_clear_ints;
+-      if ((event1 | event2) & TPS_REG_INT_DATA_STATUS_UPDATE)
++      if ((event1[0] | event2[0]) & TPS_REG_INT_DATA_STATUS_UPDATE)
+               if (!tps6598x_read_data_status(tps))
+                       goto err_clear_ints;
+       /* Handle plug insert or removal */
+-      if ((event1 | event2) & TPS_REG_INT_PLUG_EVENT)
++      if ((event1[0] | event2[0]) & TPS_REG_INT_PLUG_EVENT)
+               tps6598x_handle_plug_event(tps, status);
+ err_clear_ints:
+-      tps6598x_write64(tps, TPS_REG_INT_CLEAR1, event1);
+-      tps6598x_write64(tps, TPS_REG_INT_CLEAR2, event2);
++      tps6598x_block_write(tps, TPS_REG_INT_CLEAR1, event1, intev_len);
++      tps6598x_block_write(tps, TPS_REG_INT_CLEAR2, event2, intev_len);
+ err_unlock:
+       mutex_unlock(&tps->lock);
+-      if (event1 | event2)
++      if (event1[0] | event1[1] | event2[0] | event2[1])
+               return IRQ_HANDLED;
++
+       return IRQ_NONE;
+ }
+--- a/drivers/usb/typec/tipd/tps6598x.h
++++ b/drivers/usb/typec/tipd/tps6598x.h
+@@ -199,4 +199,15 @@
+ #define TPS_DATA_STATUS_DP_SPEC_PIN_ASSIGNMENT_A    BIT(2)
+ #define TPS_DATA_STATUS_DP_SPEC_PIN_ASSIGNMENT_B    (BIT(2) | BIT(1))
++/* Version Register */
++#define TPS_VERSION_HW_VERSION_MASK            GENMASK(31, 24)
++#define TPS_VERSION_HW_VERSION(x)              TPS_FIELD_GET(TPS_VERSION_HW_VERSION_MASK, (x))
++#define TPS_VERSION_HW_65981_2_6               0x00
++#define TPS_VERSION_HW_65987_8_DH              0xF7
++#define TPS_VERSION_HW_65987_8_DK              0xF9
++
++/* Int Event Register length */
++#define TPS_65981_2_6_INTEVENT_LEN             8
++#define TPS_65987_8_INTEVENT_LEN               11
++
+ #endif /* __TPS6598X_H__ */
diff --git a/queue-6.1/usb-typec-ucsi-displayport-fix-potential-deadlock.patch b/queue-6.1/usb-typec-ucsi-displayport-fix-potential-deadlock.patch
new file mode 100644 (file)
index 0000000..2901803
--- /dev/null
@@ -0,0 +1,51 @@
+From b791a67f68121d69108640d4a3e591d210ffe850 Mon Sep 17 00:00:00 2001
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Date: Tue, 7 May 2024 16:43:16 +0300
+Subject: usb: typec: ucsi: displayport: Fix potential deadlock
+
+From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+
+commit b791a67f68121d69108640d4a3e591d210ffe850 upstream.
+
+The function ucsi_displayport_work() does not access the
+connector, so it also must not acquire the connector lock.
+
+This fixes a potential deadlock scenario:
+
+ucsi_displayport_work() -> lock(&con->lock)
+typec_altmode_vdm()
+dp_altmode_vdm()
+dp_altmode_work()
+typec_altmode_enter()
+ucsi_displayport_enter() -> lock(&con->lock)
+
+Reported-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Fixes: af8622f6a585 ("usb: typec: ucsi: Support for DisplayPort alt mode")
+Cc: stable@vger.kernel.org
+Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Link: https://lore.kernel.org/r/20240507134316.161999-1-heikki.krogerus@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/typec/ucsi/displayport.c |    4 ----
+ 1 file changed, 4 deletions(-)
+
+--- a/drivers/usb/typec/ucsi/displayport.c
++++ b/drivers/usb/typec/ucsi/displayport.c
+@@ -275,8 +275,6 @@ static void ucsi_displayport_work(struct
+       struct ucsi_dp *dp = container_of(work, struct ucsi_dp, work);
+       int ret;
+-      mutex_lock(&dp->con->lock);
+-
+       ret = typec_altmode_vdm(dp->alt, dp->header,
+                               dp->vdo_data, dp->vdo_size);
+       if (ret)
+@@ -285,8 +283,6 @@ static void ucsi_displayport_work(struct
+       dp->vdo_data = NULL;
+       dp->vdo_size = 0;
+       dp->header = 0;
+-
+-      mutex_unlock(&dp->con->lock);
+ }
+ void ucsi_displayport_remove_partner(struct typec_altmode *alt)