]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Dec 2023 17:55:59 +0000 (18:55 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 Dec 2023 17:55:59 +0000 (18:55 +0100)
added patches:
alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch
cred-switch-to-using-atomic_long_t.patch
revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch

queue-5.4/alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch [new file with mode: 0644]
queue-5.4/cred-switch-to-using-atomic_long_t.patch [new file with mode: 0644]
queue-5.4/revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch b/queue-5.4/alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch
new file mode 100644 (file)
index 0000000..1155092
--- /dev/null
@@ -0,0 +1,43 @@
+From 924f5ca2975b2993ee81a7ecc3c809943a70f334 Mon Sep 17 00:00:00 2001
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Date: Fri, 8 Dec 2023 15:21:27 +0200
+Subject: ALSA: hda/hdmi: add force-connect quirks for ASUSTeK Z170 variants
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+
+commit 924f5ca2975b2993ee81a7ecc3c809943a70f334 upstream.
+
+On ASUSTeK Z170M PLUS and Z170 PRO GAMING systems, the display codec
+pins are not registered properly without the force-connect quirk. The
+codec will report only one pin as having external connectivity, but i915
+finds all three connectors on the system, so the two drivers are not
+in sync.
+
+Issue found with DRM igt-gpu-tools test kms_hdmi_inject@inject-audio.
+
+Link: https://gitlab.freedesktop.org/drm/intel/-/issues/9801
+Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
+Cc: Jani Saarinen <jani.saarinen@intel.com>
+Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Cc: <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20231208132127.2438067-3-kai.vehmanen@linux.intel.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_hdmi.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -1822,6 +1822,8 @@ static const struct snd_pci_quirk force_
+       SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1),
+       SND_PCI_QUIRK(0x103c, 0x8711, "HP", 1),
+       SND_PCI_QUIRK(0x103c, 0x8715, "HP", 1),
++      SND_PCI_QUIRK(0x1043, 0x86ae, "ASUS", 1),  /* Z170 PRO */
++      SND_PCI_QUIRK(0x1043, 0x86c7, "ASUS", 1),  /* Z170M PLUS */
+       SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1),
+       {}
+ };
diff --git a/queue-5.4/cred-switch-to-using-atomic_long_t.patch b/queue-5.4/cred-switch-to-using-atomic_long_t.patch
new file mode 100644 (file)
index 0000000..bbf5e9f
--- /dev/null
@@ -0,0 +1,246 @@
+From f8fa5d76925991976b3e7076f9d1052515ec1fca Mon Sep 17 00:00:00 2001
+From: Jens Axboe <axboe@kernel.dk>
+Date: Fri, 15 Dec 2023 13:24:10 -0700
+Subject: cred: switch to using atomic_long_t
+
+From: Jens Axboe <axboe@kernel.dk>
+
+commit f8fa5d76925991976b3e7076f9d1052515ec1fca upstream.
+
+There are multiple ways to grab references to credentials, and the only
+protection we have against overflowing it is the memory required to do
+so.
+
+With memory sizes only moving in one direction, let's bump the reference
+count to 64-bit and move it outside the realm of feasibly overflowing.
+
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ include/linux/cred.h |    8 +++---
+ kernel/cred.c        |   64 +++++++++++++++++++++++++--------------------------
+ 2 files changed, 36 insertions(+), 36 deletions(-)
+
+--- a/include/linux/cred.h
++++ b/include/linux/cred.h
+@@ -109,7 +109,7 @@ static inline int groups_search(const st
+  * same context as task->real_cred.
+  */
+ struct cred {
+-      atomic_t        usage;
++      atomic_long_t   usage;
+ #ifdef CONFIG_DEBUG_CREDENTIALS
+       atomic_t        subscribers;    /* number of processes subscribed */
+       void            *put_addr;
+@@ -227,7 +227,7 @@ static inline bool cap_ambient_invariant
+  */
+ static inline struct cred *get_new_cred(struct cred *cred)
+ {
+-      atomic_inc(&cred->usage);
++      atomic_long_inc(&cred->usage);
+       return cred;
+ }
+@@ -259,7 +259,7 @@ static inline const struct cred *get_cre
+       struct cred *nonconst_cred = (struct cred *) cred;
+       if (!cred)
+               return NULL;
+-      if (!atomic_inc_not_zero(&nonconst_cred->usage))
++      if (!atomic_long_inc_not_zero(&nonconst_cred->usage))
+               return NULL;
+       validate_creds(cred);
+       nonconst_cred->non_rcu = 0;
+@@ -283,7 +283,7 @@ static inline void put_cred(const struct
+       if (cred) {
+               validate_creds(cred);
+-              if (atomic_dec_and_test(&(cred)->usage))
++              if (atomic_long_dec_and_test(&(cred)->usage))
+                       __put_cred(cred);
+       }
+ }
+--- a/kernel/cred.c
++++ b/kernel/cred.c
+@@ -98,17 +98,17 @@ static void put_cred_rcu(struct rcu_head
+ #ifdef CONFIG_DEBUG_CREDENTIALS
+       if (cred->magic != CRED_MAGIC_DEAD ||
+-          atomic_read(&cred->usage) != 0 ||
++          atomic_long_read(&cred->usage) != 0 ||
+           read_cred_subscribers(cred) != 0)
+               panic("CRED: put_cred_rcu() sees %p with"
+-                    " mag %x, put %p, usage %d, subscr %d\n",
++                    " mag %x, put %p, usage %ld, subscr %d\n",
+                     cred, cred->magic, cred->put_addr,
+-                    atomic_read(&cred->usage),
++                    atomic_long_read(&cred->usage),
+                     read_cred_subscribers(cred));
+ #else
+-      if (atomic_read(&cred->usage) != 0)
+-              panic("CRED: put_cred_rcu() sees %p with usage %d\n",
+-                    cred, atomic_read(&cred->usage));
++      if (atomic_long_read(&cred->usage) != 0)
++              panic("CRED: put_cred_rcu() sees %p with usage %ld\n",
++                    cred, atomic_long_read(&cred->usage));
+ #endif
+       security_cred_free(cred);
+@@ -131,11 +131,11 @@ static void put_cred_rcu(struct rcu_head
+  */
+ void __put_cred(struct cred *cred)
+ {
+-      kdebug("__put_cred(%p{%d,%d})", cred,
+-             atomic_read(&cred->usage),
++      kdebug("__put_cred(%p{%ld,%d})", cred,
++             atomic_long_read(&cred->usage),
+              read_cred_subscribers(cred));
+-      BUG_ON(atomic_read(&cred->usage) != 0);
++      BUG_ON(atomic_long_read(&cred->usage) != 0);
+ #ifdef CONFIG_DEBUG_CREDENTIALS
+       BUG_ON(read_cred_subscribers(cred) != 0);
+       cred->magic = CRED_MAGIC_DEAD;
+@@ -158,8 +158,8 @@ void exit_creds(struct task_struct *tsk)
+ {
+       struct cred *cred;
+-      kdebug("exit_creds(%u,%p,%p,{%d,%d})", tsk->pid, tsk->real_cred, tsk->cred,
+-             atomic_read(&tsk->cred->usage),
++      kdebug("exit_creds(%u,%p,%p,{%ld,%d})", tsk->pid, tsk->real_cred, tsk->cred,
++             atomic_long_read(&tsk->cred->usage),
+              read_cred_subscribers(tsk->cred));
+       cred = (struct cred *) tsk->real_cred;
+@@ -218,7 +218,7 @@ struct cred *cred_alloc_blank(void)
+       if (!new)
+               return NULL;
+-      atomic_set(&new->usage, 1);
++      atomic_long_set(&new->usage, 1);
+ #ifdef CONFIG_DEBUG_CREDENTIALS
+       new->magic = CRED_MAGIC;
+ #endif
+@@ -265,7 +265,7 @@ struct cred *prepare_creds(void)
+       memcpy(new, old, sizeof(struct cred));
+       new->non_rcu = 0;
+-      atomic_set(&new->usage, 1);
++      atomic_long_set(&new->usage, 1);
+       set_cred_subscribers(new, 0);
+       get_group_info(new->group_info);
+       get_uid(new->user);
+@@ -345,8 +345,8 @@ int copy_creds(struct task_struct *p, un
+               p->real_cred = get_cred(p->cred);
+               get_cred(p->cred);
+               alter_cred_subscribers(p->cred, 2);
+-              kdebug("share_creds(%p{%d,%d})",
+-                     p->cred, atomic_read(&p->cred->usage),
++              kdebug("share_creds(%p{%ld,%d})",
++                     p->cred, atomic_long_read(&p->cred->usage),
+                      read_cred_subscribers(p->cred));
+               atomic_inc(&p->cred->user->processes);
+               return 0;
+@@ -436,8 +436,8 @@ int commit_creds(struct cred *new)
+       struct task_struct *task = current;
+       const struct cred *old = task->real_cred;
+-      kdebug("commit_creds(%p{%d,%d})", new,
+-             atomic_read(&new->usage),
++      kdebug("commit_creds(%p{%ld,%d})", new,
++             atomic_long_read(&new->usage),
+              read_cred_subscribers(new));
+       BUG_ON(task->cred != old);
+@@ -446,7 +446,7 @@ int commit_creds(struct cred *new)
+       validate_creds(old);
+       validate_creds(new);
+ #endif
+-      BUG_ON(atomic_read(&new->usage) < 1);
++      BUG_ON(atomic_long_read(&new->usage) < 1);
+       get_cred(new); /* we will require a ref for the subj creds too */
+@@ -519,14 +519,14 @@ EXPORT_SYMBOL(commit_creds);
+  */
+ void abort_creds(struct cred *new)
+ {
+-      kdebug("abort_creds(%p{%d,%d})", new,
+-             atomic_read(&new->usage),
++      kdebug("abort_creds(%p{%ld,%d})", new,
++             atomic_long_read(&new->usage),
+              read_cred_subscribers(new));
+ #ifdef CONFIG_DEBUG_CREDENTIALS
+       BUG_ON(read_cred_subscribers(new) != 0);
+ #endif
+-      BUG_ON(atomic_read(&new->usage) < 1);
++      BUG_ON(atomic_long_read(&new->usage) < 1);
+       put_cred(new);
+ }
+ EXPORT_SYMBOL(abort_creds);
+@@ -542,8 +542,8 @@ const struct cred *override_creds(const
+ {
+       const struct cred *old = current->cred;
+-      kdebug("override_creds(%p{%d,%d})", new,
+-             atomic_read(&new->usage),
++      kdebug("override_creds(%p{%ld,%d})", new,
++             atomic_long_read(&new->usage),
+              read_cred_subscribers(new));
+       validate_creds(old);
+@@ -565,8 +565,8 @@ const struct cred *override_creds(const
+       rcu_assign_pointer(current->cred, new);
+       alter_cred_subscribers(old, -1);
+-      kdebug("override_creds() = %p{%d,%d}", old,
+-             atomic_read(&old->usage),
++      kdebug("override_creds() = %p{%ld,%d}", old,
++             atomic_long_read(&old->usage),
+              read_cred_subscribers(old));
+       return old;
+ }
+@@ -583,8 +583,8 @@ void revert_creds(const struct cred *old
+ {
+       const struct cred *override = current->cred;
+-      kdebug("revert_creds(%p{%d,%d})", old,
+-             atomic_read(&old->usage),
++      kdebug("revert_creds(%p{%ld,%d})", old,
++             atomic_long_read(&old->usage),
+              read_cred_subscribers(old));
+       validate_creds(old);
+@@ -698,7 +698,7 @@ struct cred *prepare_kernel_cred(struct
+       *new = *old;
+       new->non_rcu = 0;
+-      atomic_set(&new->usage, 1);
++      atomic_long_set(&new->usage, 1);
+       set_cred_subscribers(new, 0);
+       get_uid(new->user);
+       get_user_ns(new->user_ns);
+@@ -808,8 +808,8 @@ static void dump_invalid_creds(const str
+              cred == tsk->cred ? "[eff]" : "");
+       printk(KERN_ERR "CRED: ->magic=%x, put_addr=%p\n",
+              cred->magic, cred->put_addr);
+-      printk(KERN_ERR "CRED: ->usage=%d, subscr=%d\n",
+-             atomic_read(&cred->usage),
++      printk(KERN_ERR "CRED: ->usage=%ld, subscr=%d\n",
++             atomic_long_read(&cred->usage),
+              read_cred_subscribers(cred));
+       printk(KERN_ERR "CRED: ->*uid = { %d,%d,%d,%d }\n",
+               from_kuid_munged(&init_user_ns, cred->uid),
+@@ -881,9 +881,9 @@ EXPORT_SYMBOL(__validate_process_creds);
+  */
+ void validate_creds_for_do_exit(struct task_struct *tsk)
+ {
+-      kdebug("validate_creds_for_do_exit(%p,%p{%d,%d})",
++      kdebug("validate_creds_for_do_exit(%p,%p{%ld,%d})",
+              tsk->real_cred, tsk->cred,
+-             atomic_read(&tsk->cred->usage),
++             atomic_long_read(&tsk->cred->usage),
+              read_cred_subscribers(tsk->cred));
+       __validate_process_creds(tsk, __FILE__, __LINE__);
diff --git a/queue-5.4/revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch b/queue-5.4/revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch
new file mode 100644 (file)
index 0000000..f8c6212
--- /dev/null
@@ -0,0 +1,77 @@
+From 5df12742b7e3aae2594a30a9d14d5d6e9e7699f4 Mon Sep 17 00:00:00 2001
+From: Bjorn Helgaas <bhelgaas@google.com>
+Date: Thu, 14 Dec 2023 09:08:56 -0600
+Subject: Revert "PCI: acpiphp: Reassign resources on bridge if necessary"
+
+From: Bjorn Helgaas <bhelgaas@google.com>
+
+commit 5df12742b7e3aae2594a30a9d14d5d6e9e7699f4 upstream.
+
+This reverts commit 40613da52b13fb21c5566f10b287e0ca8c12c4e9 and the
+subsequent fix to it:
+
+  cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus")
+
+40613da52b13 fixed a problem where hot-adding a device with large BARs
+failed if the bridge windows programmed by firmware were not large enough.
+
+cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources()
+only for non-root bus") fixed a problem with 40613da52b13: an ACPI hot-add
+of a device on a PCI root bus (common in the virt world) or firmware
+sending ACPI Bus Check to non-existent Root Ports (e.g., on Dell Inspiron
+7352/0W6WV0) caused a NULL pointer dereference and suspend/resume hangs.
+
+Unfortunately the combination of 40613da52b13 and cc22522fd55e caused other
+problems:
+
+  - Fiona reported that hot-add of SCSI disks in QEMU virtual machine fails
+    sometimes.
+
+  - Dongli reported a similar problem with hot-add of SCSI disks.
+
+  - Jonathan reported a console freeze during boot on bare metal due to an
+    error in radeon GPU initialization.
+
+Revert both patches to avoid adding these problems.  This means we will
+again see the problems with hot-adding devices with large BARs and the NULL
+pointer dereferences and suspend/resume issues that 40613da52b13 and
+cc22522fd55e were intended to fix.
+
+Fixes: 40613da52b13 ("PCI: acpiphp: Reassign resources on bridge if necessary")
+Fixes: cc22522fd55e ("PCI: acpiphp: Use pci_assign_unassigned_bridge_resources() only for non-root bus")
+Reported-by: Fiona Ebner <f.ebner@proxmox.com>
+Closes: https://lore.kernel.org/r/9eb669c0-d8f2-431d-a700-6da13053ae54@proxmox.com
+Reported-by: Dongli Zhang <dongli.zhang@oracle.com>
+Closes: https://lore.kernel.org/r/3c4a446a-b167-11b8-f36f-d3c1b49b42e9@oracle.com
+Reported-by: Jonathan Woithe <jwoithe@just42.net>
+Closes: https://lore.kernel.org/r/ZXpaNCLiDM+Kv38H@marvin.atrad.com.au
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Acked-by: Michael S. Tsirkin <mst@redhat.com>
+Acked-by: Igor Mammedov <imammedo@redhat.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pci/hotplug/acpiphp_glue.c |    9 +++------
+ 1 file changed, 3 insertions(+), 6 deletions(-)
+
+--- a/drivers/pci/hotplug/acpiphp_glue.c
++++ b/drivers/pci/hotplug/acpiphp_glue.c
+@@ -510,15 +510,12 @@ static void enable_slot(struct acpiphp_s
+                               if (pass && dev->subordinate) {
+                                       check_hotplug_bridge(slot, dev);
+                                       pcibios_resource_survey_bus(dev->subordinate);
+-                                      if (pci_is_root_bus(bus))
+-                                              __pci_bus_size_bridges(dev->subordinate, &add_list);
++                                      __pci_bus_size_bridges(dev->subordinate,
++                                                             &add_list);
+                               }
+                       }
+               }
+-              if (pci_is_root_bus(bus))
+-                      __pci_bus_assign_resources(bus, &add_list, NULL);
+-              else
+-                      pci_assign_unassigned_bridge_resources(bus->self);
++              __pci_bus_assign_resources(bus, &add_list, NULL);
+       }
+       acpiphp_sanitize_bus(bus);
index 18e5ad0dd1d12927aad6f235c9984b2d96c53f6f..18c530e1db58965b0f75b35f7ec9d39bd00e4a83 100644 (file)
@@ -14,3 +14,6 @@ vsock-virtio-fix-unsigned-integer-wrap-around-in-vir.patch
 net-stmmac-use-dev_err_probe-for-reporting-mdio-bus-.patch
 net-stmmac-handle-disabled-mdio-busses-from-devicetr.patch
 appletalk-fix-use-after-free-in-atalk_ioctl.patch
+cred-switch-to-using-atomic_long_t.patch
+alsa-hda-hdmi-add-force-connect-quirks-for-asustek-z170-variants.patch
+revert-pci-acpiphp-reassign-resources-on-bridge-if-necessary.patch