]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Sat, 5 Oct 2024 18:29:14 +0000 (14:29 -0400)
committerSasha Levin <sashal@kernel.org>
Sat, 5 Oct 2024 18:29:14 +0000 (14:29 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch [new file with mode: 0644]
queue-4.19/alsa-hda-generic-unconditionally-prefer-preferred_da.patch [new file with mode: 0644]
queue-4.19/f2fs-require-fmode_write-for-atomic-write-ioctls.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch b/queue-4.19/alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch
new file mode 100644 (file)
index 0000000..48bb1f0
--- /dev/null
@@ -0,0 +1,72 @@
+From b88ecf90f6042459cce3f3d775e34e71e631347c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 4 Oct 2024 10:25:58 +0200
+Subject: ALSA: hda/conexant: Fix conflicting quirk for System76 Pangolin
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit b3ebb007060f89d5a45c9b99f06a55e36a1945b5 ]
+
+We received a regression report for System76 Pangolin (pang14) due to
+the recent fix for Tuxedo Sirius devices to support the top speaker.
+The reason was the conflicting PCI SSID, as often seen.
+
+As a workaround, now the codec SSID is checked and the quirk is
+applied conditionally only to Sirius devices.
+
+Fixes: 4178d78cd7a8 ("ALSA: hda/conexant: Add pincfg quirk to enable top speakers on Sirius devices")
+Reported-by: Christian Heusel <christian@heusel.eu>
+Reported-by: Jerry <jerryluo225@gmail.com>
+Closes: https://lore.kernel.org/c930b6a6-64e5-498f-b65a-1cd5e0a1d733@heusel.eu
+Link: https://patch.msgid.link/20241004082602.29016-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_conexant.c | 24 +++++++++++++++++++-----
+ 1 file changed, 19 insertions(+), 5 deletions(-)
+
+diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
+index 1d95977b4a91f..ad658f6982576 100644
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -730,6 +730,23 @@ static const struct hda_pintbl cxt_pincfg_sws_js201d[] = {
+       {}
+ };
++/* pincfg quirk for Tuxedo Sirius;
++ * unfortunately the (PCI) SSID conflicts with System76 Pangolin pang14,
++ * which has incompatible pin setup, so we check the codec SSID (luckily
++ * different one!) and conditionally apply the quirk here
++ */
++static void cxt_fixup_sirius_top_speaker(struct hda_codec *codec,
++                                       const struct hda_fixup *fix,
++                                       int action)
++{
++      /* ignore for incorrectly picked-up pang14 */
++      if (codec->core.subsystem_id == 0x278212b3)
++              return;
++      /* set up the top speaker pin */
++      if (action == HDA_FIXUP_ACT_PRE_PROBE)
++              snd_hda_codec_set_pincfg(codec, 0x1d, 0x82170111);
++}
++
+ static const struct hda_fixup cxt_fixups[] = {
+       [CXT_PINCFG_LENOVO_X200] = {
+               .type = HDA_FIXUP_PINS,
+@@ -886,11 +903,8 @@ static const struct hda_fixup cxt_fixups[] = {
+               .v.pins = cxt_pincfg_sws_js201d,
+       },
+       [CXT_PINCFG_TOP_SPEAKER] = {
+-              .type = HDA_FIXUP_PINS,
+-              .v.pins = (const struct hda_pintbl[]) {
+-                      { 0x1d, 0x82170111 },
+-                      { }
+-              },
++              .type = HDA_FIXUP_FUNC,
++              .v.func = cxt_fixup_sirius_top_speaker,
+       },
+ };
+-- 
+2.43.0
+
diff --git a/queue-4.19/alsa-hda-generic-unconditionally-prefer-preferred_da.patch b/queue-4.19/alsa-hda-generic-unconditionally-prefer-preferred_da.patch
new file mode 100644 (file)
index 0000000..0df2159
--- /dev/null
@@ -0,0 +1,60 @@
+From 688e6d10e2d21ffd2656427e257fa8beeb1628ee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 1 Oct 2024 14:14:36 +0200
+Subject: ALSA: hda/generic: Unconditionally prefer preferred_dacs pairs
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 1c801e7f77445bc56e5e1fec6191fd4503534787 ]
+
+Some time ago, we introduced the obey_preferred_dacs flag for choosing
+the DAC/pin pairs specified by the driver instead of parsing the
+paths.  This works as expected, per se, but there have been a few
+cases where we forgot to set this flag while preferred_dacs table is
+already set up.  It ended up with incorrect wiring and made us
+wondering why it doesn't work.
+
+Basically, when the preferred_dacs table is provided, it means that
+the driver really wants to wire up to follow that.  That is, the
+presence of the preferred_dacs table itself is already a "do-it"
+flag.
+
+In this patch, we simply replace the evaluation of obey_preferred_dacs
+flag with the presence of preferred_dacs table for fixing the
+misbehavior.  Another patch to drop of the obsoleted flag will
+follow.
+
+Fixes: 242d990c158d ("ALSA: hda/generic: Add option to enforce preferred_dacs pairs")
+Link: https://bugzilla.suse.com/show_bug.cgi?id=1219803
+Link: https://patch.msgid.link/20241001121439.26060-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_generic.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
+index f4b07dc6f1cc1..e48dca4d6e43f 100644
+--- a/sound/pci/hda/hda_generic.c
++++ b/sound/pci/hda/hda_generic.c
+@@ -1383,7 +1383,7 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
+               struct nid_path *path;
+               hda_nid_t pin = pins[i];
+-              if (!spec->obey_preferred_dacs) {
++              if (!spec->preferred_dacs) {
+                       path = snd_hda_get_path_from_idx(codec, path_idx[i]);
+                       if (path) {
+                               badness += assign_out_path_ctls(codec, path);
+@@ -1395,7 +1395,7 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
+               if (dacs[i]) {
+                       if (is_dac_already_used(codec, dacs[i]))
+                               badness += bad->shared_primary;
+-              } else if (spec->obey_preferred_dacs) {
++              } else if (spec->preferred_dacs) {
+                       badness += BAD_NO_PRIMARY_DAC;
+               }
+-- 
+2.43.0
+
diff --git a/queue-4.19/f2fs-require-fmode_write-for-atomic-write-ioctls.patch b/queue-4.19/f2fs-require-fmode_write-for-atomic-write-ioctls.patch
new file mode 100644 (file)
index 0000000..ecf03ab
--- /dev/null
@@ -0,0 +1,97 @@
+From 8daeba70da8a8d49376b6c868580bff2b5e7b9b3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 4 Oct 2024 19:37:49 +0000
+Subject: f2fs: Require FMODE_WRITE for atomic write ioctls
+
+From: Jann Horn <jannh@google.com>
+
+commit 4f5a100f87f32cb65d4bb1ad282a08c92f6f591e upstream.
+
+The F2FS ioctls for starting and committing atomic writes check for
+inode_owner_or_capable(), but this does not give LSMs like SELinux or
+Landlock an opportunity to deny the write access - if the caller's FSUID
+matches the inode's UID, inode_owner_or_capable() immediately returns true.
+
+There are scenarios where LSMs want to deny a process the ability to write
+particular files, even files that the FSUID of the process owns; but this
+can currently partially be bypassed using atomic write ioctls in two ways:
+
+ - F2FS_IOC_START_ATOMIC_REPLACE + F2FS_IOC_COMMIT_ATOMIC_WRITE can
+   truncate an inode to size 0
+ - F2FS_IOC_START_ATOMIC_WRITE + F2FS_IOC_ABORT_ATOMIC_WRITE can revert
+   changes another process concurrently made to a file
+
+Fix it by requiring FMODE_WRITE for these operations, just like for
+F2FS_IOC_MOVE_RANGE. Since any legitimate caller should only be using these
+ioctls when intending to write into the file, that seems unlikely to break
+anything.
+
+Fixes: 88b88a667971 ("f2fs: support atomic writes")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jann Horn <jannh@google.com>
+Reviewed-by: Chao Yu <chao@kernel.org>
+Reviewed-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Signed-off-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/file.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
+index 41eec5bfc7b31..aabc5fe45a3bd 100644
+--- a/fs/f2fs/file.c
++++ b/fs/f2fs/file.c
+@@ -1716,6 +1716,9 @@ static int f2fs_ioc_start_atomic_write(struct file *filp)
+       struct inode *inode = file_inode(filp);
+       int ret;
++      if (!(filp->f_mode & FMODE_WRITE))
++              return -EBADF;
++
+       if (!inode_owner_or_capable(inode))
+               return -EACCES;
+@@ -1773,6 +1776,9 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp)
+       struct inode *inode = file_inode(filp);
+       int ret;
++      if (!(filp->f_mode & FMODE_WRITE))
++              return -EBADF;
++
+       if (!inode_owner_or_capable(inode))
+               return -EACCES;
+@@ -1818,6 +1824,9 @@ static int f2fs_ioc_start_volatile_write(struct file *filp)
+       struct inode *inode = file_inode(filp);
+       int ret;
++      if (!(filp->f_mode & FMODE_WRITE))
++              return -EBADF;
++
+       if (!inode_owner_or_capable(inode))
+               return -EACCES;
+@@ -1853,6 +1862,9 @@ static int f2fs_ioc_release_volatile_write(struct file *filp)
+       struct inode *inode = file_inode(filp);
+       int ret;
++      if (!(filp->f_mode & FMODE_WRITE))
++              return -EBADF;
++
+       if (!inode_owner_or_capable(inode))
+               return -EACCES;
+@@ -1882,6 +1894,9 @@ static int f2fs_ioc_abort_volatile_write(struct file *filp)
+       struct inode *inode = file_inode(filp);
+       int ret;
++      if (!(filp->f_mode & FMODE_WRITE))
++              return -EBADF;
++
+       if (!inode_owner_or_capable(inode))
+               return -EACCES;
+-- 
+2.43.0
+
index 81a69c6913f28783bb027ea81a946677776a5187..873d63b21a27806a6fcabd8c6bacb32839e1f626 100644 (file)
@@ -145,3 +145,6 @@ net-avoid-potential-underflow-in-qdisc_pkt_len_init-.patch
 net-add-more-sanity-checks-to-qdisc_pkt_len_init.patch
 ipv4-ip_gre-fix-drops-of-small-packets-in-ipgre_xmit.patch
 sctp-set-sk_state-back-to-closed-if-autobind-fails-i.patch
+alsa-hda-generic-unconditionally-prefer-preferred_da.patch
+alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch
+f2fs-require-fmode_write-for-atomic-write-ioctls.patch