]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Apr 2024 12:13:09 +0000 (14:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 23 Apr 2024 12:13:09 +0000 (14:13 +0200)
added patches:
alsa-hda-realtek-enable-audio-jacks-of-haier-boyue-g42-with-alc269vc.patch
binder-check-offset-alignment-in-binder_get_object.patch
comedi-vmk80xx-fix-incomplete-endpoint-checking.patch
thunderbolt-avoid-notify-pm-core-about-runtime-pm-resume.patch
thunderbolt-fix-wake-configurations-after-device-unplug.patch

queue-6.1/alsa-hda-realtek-enable-audio-jacks-of-haier-boyue-g42-with-alc269vc.patch [new file with mode: 0644]
queue-6.1/binder-check-offset-alignment-in-binder_get_object.patch [new file with mode: 0644]
queue-6.1/comedi-vmk80xx-fix-incomplete-endpoint-checking.patch [new file with mode: 0644]
queue-6.1/series
queue-6.1/thunderbolt-avoid-notify-pm-core-about-runtime-pm-resume.patch [new file with mode: 0644]
queue-6.1/thunderbolt-fix-wake-configurations-after-device-unplug.patch [new file with mode: 0644]

diff --git a/queue-6.1/alsa-hda-realtek-enable-audio-jacks-of-haier-boyue-g42-with-alc269vc.patch b/queue-6.1/alsa-hda-realtek-enable-audio-jacks-of-haier-boyue-g42-with-alc269vc.patch
new file mode 100644 (file)
index 0000000..3c35c4b
--- /dev/null
@@ -0,0 +1,32 @@
+From 7ee5faad0f8c3ad86c8cfc2f6aac91d2ba29790f Mon Sep 17 00:00:00 2001
+From: Ai Chao <aichao@kylinos.cn>
+Date: Fri, 19 Apr 2024 16:21:59 +0800
+Subject: ALSA: hda/realtek - Enable audio jacks of Haier Boyue G42 with ALC269VC
+
+From: Ai Chao <aichao@kylinos.cn>
+
+commit 7ee5faad0f8c3ad86c8cfc2f6aac91d2ba29790f upstream.
+
+The Haier Boyue G42 with ALC269VC cannot detect the MIC of headset,
+the line out and internal speaker until
+ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS quirk applied.
+
+Signed-off-by: Ai Chao <aichao@kylinos.cn>
+Cc: <stable@vger.kernel.org>
+Message-ID: <20240419082159.476879-1-aichao@kylinos.cn>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -10122,6 +10122,7 @@ static const struct snd_pci_quirk alc269
+       SND_PCI_QUIRK(0x1d05, 0x115c, "TongFang GMxTGxx", ALC269_FIXUP_NO_SHUTUP),
+       SND_PCI_QUIRK(0x1d05, 0x121b, "TongFang GMxAGxx", ALC269_FIXUP_NO_SHUTUP),
+       SND_PCI_QUIRK(0x1d05, 0x1387, "TongFang GMxIXxx", ALC2XX_FIXUP_HEADSET_MIC),
++      SND_PCI_QUIRK(0x1d17, 0x3288, "Haier Boyue G42", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
+       SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
diff --git a/queue-6.1/binder-check-offset-alignment-in-binder_get_object.patch b/queue-6.1/binder-check-offset-alignment-in-binder_get_object.patch
new file mode 100644 (file)
index 0000000..65a8973
--- /dev/null
@@ -0,0 +1,46 @@
+From aaef73821a3b0194a01bd23ca77774f704a04d40 Mon Sep 17 00:00:00 2001
+From: Carlos Llamas <cmllamas@google.com>
+Date: Sat, 30 Mar 2024 19:01:14 +0000
+Subject: binder: check offset alignment in binder_get_object()
+
+From: Carlos Llamas <cmllamas@google.com>
+
+commit aaef73821a3b0194a01bd23ca77774f704a04d40 upstream.
+
+Commit 6d98eb95b450 ("binder: avoid potential data leakage when copying
+txn") introduced changes to how binder objects are copied. In doing so,
+it unintentionally removed an offset alignment check done through calls
+to binder_alloc_copy_from_buffer() -> check_buffer().
+
+These calls were replaced in binder_get_object() with copy_from_user(),
+so now an explicit offset alignment check is needed here. This avoids
+later complications when unwinding the objects gets harder.
+
+It is worth noting this check existed prior to commit 7a67a39320df
+("binder: add function to copy binder object from buffer"), likely
+removed due to redundancy at the time.
+
+Fixes: 6d98eb95b450 ("binder: avoid potential data leakage when copying txn")
+Cc: stable@vger.kernel.org
+Signed-off-by: Carlos Llamas <cmllamas@google.com>
+Acked-by: Todd Kjos <tkjos@google.com>
+Link: https://lore.kernel.org/r/20240330190115.1877819-1-cmllamas@google.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/android/binder.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/android/binder.c
++++ b/drivers/android/binder.c
+@@ -1707,8 +1707,10 @@ static size_t binder_get_object(struct b
+       size_t object_size = 0;
+       read_size = min_t(size_t, sizeof(*object), buffer->data_size - offset);
+-      if (offset > buffer->data_size || read_size < sizeof(*hdr))
++      if (offset > buffer->data_size || read_size < sizeof(*hdr) ||
++          !IS_ALIGNED(offset, sizeof(u32)))
+               return 0;
++
+       if (u) {
+               if (copy_from_user(object, u + offset, read_size))
+                       return 0;
diff --git a/queue-6.1/comedi-vmk80xx-fix-incomplete-endpoint-checking.patch b/queue-6.1/comedi-vmk80xx-fix-incomplete-endpoint-checking.patch
new file mode 100644 (file)
index 0000000..68cc510
--- /dev/null
@@ -0,0 +1,98 @@
+From d1718530e3f640b7d5f0050e725216eab57a85d8 Mon Sep 17 00:00:00 2001
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Date: Mon, 8 Apr 2024 10:16:33 -0700
+Subject: comedi: vmk80xx: fix incomplete endpoint checking
+
+From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+
+commit d1718530e3f640b7d5f0050e725216eab57a85d8 upstream.
+
+While vmk80xx does have endpoint checking implemented, some things
+can fall through the cracks. Depending on the hardware model,
+URBs can have either bulk or interrupt type, and current version
+of vmk80xx_find_usb_endpoints() function does not take that fully
+into account. While this warning does not seem to be too harmful,
+at the very least it will crash systems with 'panic_on_warn' set on
+them.
+
+Fix the issue found by Syzkaller [1] by somewhat simplifying the
+endpoint checking process with usb_find_common_endpoints() and
+ensuring that only expected endpoint types are present.
+
+This patch has not been tested on real hardware.
+
+[1] Syzkaller report:
+usb 1-1: BOGUS urb xfer, pipe 1 != type 3
+WARNING: CPU: 0 PID: 781 at drivers/usb/core/urb.c:504 usb_submit_urb+0xc4e/0x18c0 drivers/usb/core/urb.c:503
+...
+Call Trace:
+ <TASK>
+ usb_start_wait_urb+0x113/0x520 drivers/usb/core/message.c:59
+ vmk80xx_reset_device drivers/comedi/drivers/vmk80xx.c:227 [inline]
+ vmk80xx_auto_attach+0xa1c/0x1a40 drivers/comedi/drivers/vmk80xx.c:818
+ comedi_auto_config+0x238/0x380 drivers/comedi/drivers.c:1067
+ usb_probe_interface+0x5cd/0xb00 drivers/usb/core/driver.c:399
+...
+
+Similar issue also found by Syzkaller:
+Link: https://syzkaller.appspot.com/bug?extid=5205eb2f17de3e01946e
+
+Reported-and-tested-by: syzbot+5f29dc6a889fc42bd896@syzkaller.appspotmail.com
+Cc: stable <stable@kernel.org>
+Fixes: 49253d542cc0 ("staging: comedi: vmk80xx: factor out usb endpoint detection")
+Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
+Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
+Link: https://lore.kernel.org/r/20240408171633.31649-1-n.zhandarovich@fintech.ru
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/comedi/drivers/vmk80xx.c |   35 ++++++++++++-----------------------
+ 1 file changed, 12 insertions(+), 23 deletions(-)
+
+--- a/drivers/comedi/drivers/vmk80xx.c
++++ b/drivers/comedi/drivers/vmk80xx.c
+@@ -641,33 +641,22 @@ static int vmk80xx_find_usb_endpoints(st
+       struct vmk80xx_private *devpriv = dev->private;
+       struct usb_interface *intf = comedi_to_usb_interface(dev);
+       struct usb_host_interface *iface_desc = intf->cur_altsetting;
+-      struct usb_endpoint_descriptor *ep_desc;
+-      int i;
++      struct usb_endpoint_descriptor *ep_rx_desc, *ep_tx_desc;
++      int ret;
+-      if (iface_desc->desc.bNumEndpoints != 2)
+-              return -ENODEV;
+-
+-      for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
+-              ep_desc = &iface_desc->endpoint[i].desc;
+-
+-              if (usb_endpoint_is_int_in(ep_desc) ||
+-                  usb_endpoint_is_bulk_in(ep_desc)) {
+-                      if (!devpriv->ep_rx)
+-                              devpriv->ep_rx = ep_desc;
+-                      continue;
+-              }
++      if (devpriv->model == VMK8061_MODEL)
++              ret = usb_find_common_endpoints(iface_desc, &ep_rx_desc,
++                                              &ep_tx_desc, NULL, NULL);
++      else
++              ret = usb_find_common_endpoints(iface_desc, NULL, NULL,
++                                              &ep_rx_desc, &ep_tx_desc);
+-              if (usb_endpoint_is_int_out(ep_desc) ||
+-                  usb_endpoint_is_bulk_out(ep_desc)) {
+-                      if (!devpriv->ep_tx)
+-                              devpriv->ep_tx = ep_desc;
+-                      continue;
+-              }
+-      }
+-
+-      if (!devpriv->ep_rx || !devpriv->ep_tx)
++      if (ret)
+               return -ENODEV;
++      devpriv->ep_rx = ep_rx_desc;
++      devpriv->ep_tx = ep_tx_desc;
++
+       if (!usb_endpoint_maxp(devpriv->ep_rx) || !usb_endpoint_maxp(devpriv->ep_tx))
+               return -EINVAL;
index cfb8a8b8131dd66fbbf03e38c35177de0f145da8..943cd38de626c8c75e8de9a77ae6c2d2fb18db2f 100644 (file)
@@ -98,3 +98,8 @@ clk-mediatek-clk-mtk-extend-mtk_clk_simple_probe.patch
 clk-mediatek-do-a-runtime-pm-get-on-controllers-duri.patch
 x86-bugs-fix-bhi-retpoline-check.patch
 x86-cpufeatures-fix-dependencies-for-gfni-vaes-and-v.patch
+alsa-hda-realtek-enable-audio-jacks-of-haier-boyue-g42-with-alc269vc.patch
+binder-check-offset-alignment-in-binder_get_object.patch
+thunderbolt-avoid-notify-pm-core-about-runtime-pm-resume.patch
+thunderbolt-fix-wake-configurations-after-device-unplug.patch
+comedi-vmk80xx-fix-incomplete-endpoint-checking.patch
diff --git a/queue-6.1/thunderbolt-avoid-notify-pm-core-about-runtime-pm-resume.patch b/queue-6.1/thunderbolt-avoid-notify-pm-core-about-runtime-pm-resume.patch
new file mode 100644 (file)
index 0000000..dcdfc27
--- /dev/null
@@ -0,0 +1,152 @@
+From dcd12acaf384c30437fa5a9a1f71df06fc9835fd Mon Sep 17 00:00:00 2001
+From: Gil Fine <gil.fine@linux.intel.com>
+Date: Fri, 1 Mar 2024 15:11:18 +0200
+Subject: thunderbolt: Avoid notify PM core about runtime PM resume
+
+From: Gil Fine <gil.fine@linux.intel.com>
+
+commit dcd12acaf384c30437fa5a9a1f71df06fc9835fd upstream.
+
+Currently we notify PM core about occurred wakes after any resume. This
+is not actually needed after resume from runtime suspend. Hence, notify
+PM core about occurred wakes only after resume from system sleep. Also,
+if the wake occurred in USB4 router upstream port, we don't notify the
+PM core about it since it is not actually needed and can cause
+unexpected autowake (e.g. if /sys/power/wakeup_count is used).
+
+While there add the missing kernel-doc for tb_switch_resume().
+
+Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/thunderbolt/switch.c |   27 +++++++++++++++++++++++++--
+ drivers/thunderbolt/tb.c     |    4 ++--
+ drivers/thunderbolt/tb.h     |    3 ++-
+ drivers/thunderbolt/usb4.c   |   13 +++++++------
+ 4 files changed, 36 insertions(+), 11 deletions(-)
+
+--- a/drivers/thunderbolt/switch.c
++++ b/drivers/thunderbolt/switch.c
+@@ -3135,7 +3135,26 @@ static int tb_switch_set_wake(struct tb_
+       return tb_lc_set_wake(sw, flags);
+ }
+-int tb_switch_resume(struct tb_switch *sw)
++static void tb_switch_check_wakes(struct tb_switch *sw)
++{
++      if (device_may_wakeup(&sw->dev)) {
++              if (tb_switch_is_usb4(sw))
++                      usb4_switch_check_wakes(sw);
++      }
++}
++
++/**
++ * tb_switch_resume() - Resume a switch after sleep
++ * @sw: Switch to resume
++ * @runtime: Is this resume from runtime suspend or system sleep
++ *
++ * Resumes and re-enumerates router (and all its children), if still plugged
++ * after suspend. Don't enumerate device router whose UID was changed during
++ * suspend. If this is resume from system sleep, notifies PM core about the
++ * wakes occurred during suspend. Disables all wakes, except USB4 wake of
++ * upstream port for USB4 routers that shall be always enabled.
++ */
++int tb_switch_resume(struct tb_switch *sw, bool runtime)
+ {
+       struct tb_port *port;
+       int err;
+@@ -3184,6 +3203,9 @@ int tb_switch_resume(struct tb_switch *s
+       if (err)
+               return err;
++      if (!runtime)
++              tb_switch_check_wakes(sw);
++
+       /* Disable wakes */
+       tb_switch_set_wake(sw, 0);
+@@ -3213,7 +3235,8 @@ int tb_switch_resume(struct tb_switch *s
+                        */
+                       if (tb_port_unlock(port))
+                               tb_port_warn(port, "failed to unlock port\n");
+-                      if (port->remote && tb_switch_resume(port->remote->sw)) {
++                      if (port->remote &&
++                          tb_switch_resume(port->remote->sw, runtime)) {
+                               tb_port_warn(port,
+                                            "lost during suspend, disconnecting\n");
+                               tb_sw_set_unplugged(port->remote->sw);
+--- a/drivers/thunderbolt/tb.c
++++ b/drivers/thunderbolt/tb.c
+@@ -1628,7 +1628,7 @@ static int tb_resume_noirq(struct tb *tb
+       /* remove any pci devices the firmware might have setup */
+       tb_switch_reset(tb->root_switch);
+-      tb_switch_resume(tb->root_switch);
++      tb_switch_resume(tb->root_switch, false);
+       tb_free_invalid_tunnels(tb);
+       tb_free_unplugged_children(tb->root_switch);
+       tb_restore_children(tb->root_switch);
+@@ -1754,7 +1754,7 @@ static int tb_runtime_resume(struct tb *
+       struct tb_tunnel *tunnel, *n;
+       mutex_lock(&tb->lock);
+-      tb_switch_resume(tb->root_switch);
++      tb_switch_resume(tb->root_switch, true);
+       tb_free_invalid_tunnels(tb);
+       tb_restore_children(tb->root_switch);
+       list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list)
+--- a/drivers/thunderbolt/tb.h
++++ b/drivers/thunderbolt/tb.h
+@@ -787,7 +787,7 @@ int tb_switch_configure(struct tb_switch
+ int tb_switch_add(struct tb_switch *sw);
+ void tb_switch_remove(struct tb_switch *sw);
+ void tb_switch_suspend(struct tb_switch *sw, bool runtime);
+-int tb_switch_resume(struct tb_switch *sw);
++int tb_switch_resume(struct tb_switch *sw, bool runtime);
+ int tb_switch_reset(struct tb_switch *sw);
+ int tb_switch_wait_for_bit(struct tb_switch *sw, u32 offset, u32 bit,
+                          u32 value, int timeout_msec);
+@@ -1182,6 +1182,7 @@ static inline struct tb_retimer *tb_to_r
+       return NULL;
+ }
++void usb4_switch_check_wakes(struct tb_switch *sw);
+ int usb4_switch_setup(struct tb_switch *sw);
+ int usb4_switch_read_uid(struct tb_switch *sw, u64 *uid);
+ int usb4_switch_drom_read(struct tb_switch *sw, unsigned int address, void *buf,
+--- a/drivers/thunderbolt/usb4.c
++++ b/drivers/thunderbolt/usb4.c
+@@ -153,15 +153,18 @@ static inline int usb4_switch_op_data(st
+                               tx_dwords, rx_data, rx_dwords);
+ }
+-static void usb4_switch_check_wakes(struct tb_switch *sw)
++/**
++ * usb4_switch_check_wakes() - Check for wakes and notify PM core about them
++ * @sw: Router whose wakes to check
++ *
++ * Checks wakes occurred during suspend and notify the PM core about them.
++ */
++void usb4_switch_check_wakes(struct tb_switch *sw)
+ {
+       struct tb_port *port;
+       bool wakeup = false;
+       u32 val;
+-      if (!device_may_wakeup(&sw->dev))
+-              return;
+-
+       if (tb_route(sw)) {
+               if (tb_sw_read(sw, &val, TB_CFG_SWITCH, ROUTER_CS_6, 1))
+                       return;
+@@ -226,8 +229,6 @@ int usb4_switch_setup(struct tb_switch *
+       u32 val = 0;
+       int ret;
+-      usb4_switch_check_wakes(sw);
+-
+       if (!tb_route(sw))
+               return 0;
diff --git a/queue-6.1/thunderbolt-fix-wake-configurations-after-device-unplug.patch b/queue-6.1/thunderbolt-fix-wake-configurations-after-device-unplug.patch
new file mode 100644 (file)
index 0000000..4ab4ee5
--- /dev/null
@@ -0,0 +1,63 @@
+From c38fa07dc69f0b9e6f43ecab96dc7861a70c827c Mon Sep 17 00:00:00 2001
+From: Gil Fine <gil.fine@linux.intel.com>
+Date: Fri, 1 Mar 2024 15:22:53 +0200
+Subject: thunderbolt: Fix wake configurations after device unplug
+
+From: Gil Fine <gil.fine@linux.intel.com>
+
+commit c38fa07dc69f0b9e6f43ecab96dc7861a70c827c upstream.
+
+Currently we don't configure correctly the wake events after unplug of device
+router. What can happen is that the downstream ports of host router will be
+configured to wake on: USB4-wake and wake-on-disconnect, but not on
+wake-on-connect. This may cause the later plugged device not to wake the
+domain and fail in enumeration. Fix this by clearing downstream port's "USB4
+Port is Configured" bit, after unplug of a device router.
+
+Signed-off-by: Gil Fine <gil.fine@linux.intel.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/thunderbolt/switch.c |   21 ++++++++++++++-------
+ 1 file changed, 14 insertions(+), 7 deletions(-)
+
+--- a/drivers/thunderbolt/switch.c
++++ b/drivers/thunderbolt/switch.c
+@@ -2880,22 +2880,29 @@ void tb_switch_unconfigure_link(struct t
+ {
+       struct tb_port *up, *down;
+-      if (sw->is_unplugged)
+-              return;
+       if (!tb_route(sw) || tb_switch_is_icm(sw))
+               return;
++      /*
++       * Unconfigure downstream port so that wake-on-connect can be
++       * configured after router unplug. No need to unconfigure upstream port
++       * since its router is unplugged.
++       */
+       up = tb_upstream_port(sw);
+-      if (tb_switch_is_usb4(up->sw))
+-              usb4_port_unconfigure(up);
+-      else
+-              tb_lc_unconfigure_port(up);
+-
+       down = up->remote;
+       if (tb_switch_is_usb4(down->sw))
+               usb4_port_unconfigure(down);
+       else
+               tb_lc_unconfigure_port(down);
++
++      if (sw->is_unplugged)
++              return;
++
++      up = tb_upstream_port(sw);
++      if (tb_switch_is_usb4(up->sw))
++              usb4_port_unconfigure(up);
++      else
++              tb_lc_unconfigure_port(up);
+ }
+ static void tb_switch_credits_init(struct tb_switch *sw)