From: Sasha Levin Date: Sat, 5 Oct 2024 18:29:11 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v6.6.55~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=525844909dffe4adb516b8c09cd40378cd522315;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch b/queue-6.1/alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch new file mode 100644 index 00000000000..6dc566de0e1 --- /dev/null +++ b/queue-6.1/alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch @@ -0,0 +1,72 @@ +From 6540edcfca5166f8809dea2407476ef12ba24f59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Oct 2024 10:25:58 +0200 +Subject: ALSA: hda/conexant: Fix conflicting quirk for System76 Pangolin + +From: Takashi Iwai + +[ 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 +Reported-by: Jerry +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 +Signed-off-by: Sasha Levin +--- + 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 63bd0e384bae2..8a3abd4babba6 100644 +--- a/sound/pci/hda/patch_conexant.c ++++ b/sound/pci/hda/patch_conexant.c +@@ -820,6 +820,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, +@@ -980,11 +997,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-6.1/alsa-hda-generic-unconditionally-prefer-preferred_da.patch b/queue-6.1/alsa-hda-generic-unconditionally-prefer-preferred_da.patch new file mode 100644 index 00000000000..3982c83ed51 --- /dev/null +++ b/queue-6.1/alsa-hda-generic-unconditionally-prefer-preferred_da.patch @@ -0,0 +1,60 @@ +From 1689703bd2f0e36c395f051b66804854f1413863 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 1 Oct 2024 14:14:36 +0200 +Subject: ALSA: hda/generic: Unconditionally prefer preferred_dacs pairs + +From: Takashi Iwai + +[ 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 +Signed-off-by: Sasha Levin +--- + 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 992cf82da1024..2551fb9c6ed0d 100644 +--- a/sound/pci/hda/hda_generic.c ++++ b/sound/pci/hda/hda_generic.c +@@ -1379,7 +1379,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); +@@ -1391,7 +1391,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-6.1/alsa-hda-realtek-fix-the-push-button-function-for-th.patch b/queue-6.1/alsa-hda-realtek-fix-the-push-button-function-for-th.patch new file mode 100644 index 00000000000..598d95b8f97 --- /dev/null +++ b/queue-6.1/alsa-hda-realtek-fix-the-push-button-function-for-th.patch @@ -0,0 +1,36 @@ +From 43212b070a57b49dd740ffcf8037ba0d24d80844 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Sep 2024 18:50:39 +0800 +Subject: ALSA: hda/realtek: Fix the push button function for the ALC257 + +From: Oder Chiou + +[ Upstream commit 05df9732a0894846c46d0062d4af535c5002799d ] + +The headset push button cannot work properly in case of the ALC257. +This patch reverted the previous commit to correct the side effect. + +Fixes: ef9718b3d54e ("ALSA: hda/realtek: Fix noise from speakers on Lenovo IdeaPad 3 15IAU7") +Signed-off-by: Oder Chiou +Link: https://patch.msgid.link/20240930105039.3473266-1-oder_chiou@realtek.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 277303cbe96de..cb6a13504d322 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -583,6 +583,7 @@ static void alc_shutup_pins(struct hda_codec *codec) + switch (codec->core.vendor_id) { + case 0x10ec0236: + case 0x10ec0256: ++ case 0x10ec0257: + case 0x19e58326: + case 0x10ec0283: + case 0x10ec0285: +-- +2.43.0 + diff --git a/queue-6.1/alsa-mixer_oss-remove-some-incorrect-kfree_const-usa.patch b/queue-6.1/alsa-mixer_oss-remove-some-incorrect-kfree_const-usa.patch new file mode 100644 index 00000000000..91c834fd64a --- /dev/null +++ b/queue-6.1/alsa-mixer_oss-remove-some-incorrect-kfree_const-usa.patch @@ -0,0 +1,44 @@ +From 93f0a589ccacaa23565efcff9aed5266dab85c1c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Sep 2024 20:17:36 +0200 +Subject: ALSA: mixer_oss: Remove some incorrect kfree_const() usages + +From: Christophe JAILLET + +[ Upstream commit 368e4663c557de4a33f321b44e7eeec0a21b2e4e ] + +"assigned" and "assigned->name" are allocated in snd_mixer_oss_proc_write() +using kmalloc() and kstrdup(), so there is no point in using kfree_const() +to free these resources. + +Switch to the more standard kfree() to free these resources. + +This could avoid a memory leak. + +Fixes: 454f5ec1d2b7 ("ALSA: mixer: oss: Constify snd_mixer_oss_assign_table definition") +Signed-off-by: Christophe JAILLET +Link: https://patch.msgid.link/63ac20f64234b7c9ea87a7fa9baf41e8255852f7.1727374631.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/oss/mixer_oss.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c +index 9620115cfdc09..c8291869ef906 100644 +--- a/sound/core/oss/mixer_oss.c ++++ b/sound/core/oss/mixer_oss.c +@@ -967,8 +967,8 @@ static void snd_mixer_oss_slot_free(struct snd_mixer_oss_slot *chn) + struct slot *p = chn->private_data; + if (p) { + if (p->allocated && p->assigned) { +- kfree_const(p->assigned->name); +- kfree_const(p->assigned); ++ kfree(p->assigned->name); ++ kfree(p->assigned); + } + kfree(p); + } +-- +2.43.0 + diff --git a/queue-6.1/asoc-atmel-mchp-pdmc-skip-alsa-restoration-if-substr.patch b/queue-6.1/asoc-atmel-mchp-pdmc-skip-alsa-restoration-if-substr.patch new file mode 100644 index 00000000000..ec9b6603094 --- /dev/null +++ b/queue-6.1/asoc-atmel-mchp-pdmc-skip-alsa-restoration-if-substr.patch @@ -0,0 +1,41 @@ +From b4f497b908553a9cd179aa5c2b03de1ba88c66d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Sep 2024 11:12:38 +0300 +Subject: ASoC: atmel: mchp-pdmc: Skip ALSA restoration if substream runtime is + uninitialized + +From: Andrei Simion + +[ Upstream commit 09cfc6a532d249a51d3af5022d37ebbe9c3d31f6 ] + +Update the driver to prevent alsa-restore.service from failing when +reading data from /var/lib/alsa/asound.state at boot. Ensure that the +restoration of ALSA mixer configurations is skipped if substream->runtime +is NULL. + +Fixes: 50291652af52 ("ASoC: atmel: mchp-pdmc: add PDMC driver") +Signed-off-by: Andrei Simion +Link: https://patch.msgid.link/20240924081237.50046-1-andrei.simion@microchip.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/atmel/mchp-pdmc.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/sound/soc/atmel/mchp-pdmc.c b/sound/soc/atmel/mchp-pdmc.c +index 44aefbd5b62c7..bdd2ae09714fe 100644 +--- a/sound/soc/atmel/mchp-pdmc.c ++++ b/sound/soc/atmel/mchp-pdmc.c +@@ -286,6 +286,9 @@ static int mchp_pdmc_chmap_ctl_put(struct snd_kcontrol *kcontrol, + if (!substream) + return -ENODEV; + ++ if (!substream->runtime) ++ return 0; /* just for avoiding error from alsactl restore */ ++ + map = mchp_pdmc_chmap_get(substream, info); + if (!map) + return -EINVAL; +-- +2.43.0 + diff --git a/queue-6.1/asoc-imx-card-set-card.owner-to-avoid-a-warning-call.patch b/queue-6.1/asoc-imx-card-set-card.owner-to-avoid-a-warning-call.patch new file mode 100644 index 00000000000..ddb8c4a5a11 --- /dev/null +++ b/queue-6.1/asoc-imx-card-set-card.owner-to-avoid-a-warning-call.patch @@ -0,0 +1,46 @@ +From d0e3fe814dd2c0a55dc2b16ac8ec35c4954c2436 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 2 Oct 2024 10:56:59 +0800 +Subject: ASoC: imx-card: Set card.owner to avoid a warning calltrace if SND=m + +From: Hui Wang + +[ Upstream commit 47d7d3fd72afc7dcd548806291793ee6f3848215 ] + +In most Linux distribution kernels, the SND is set to m, in such a +case, when booting the kernel on i.MX8MP EVK board, there is a +warning calltrace like below: + Call trace: + snd_card_init+0x484/0x4cc [snd] + snd_card_new+0x70/0xa8 [snd] + snd_soc_bind_card+0x310/0xbd0 [snd_soc_core] + snd_soc_register_card+0xf0/0x108 [snd_soc_core] + devm_snd_soc_register_card+0x4c/0xa4 [snd_soc_core] + +That is because the card.owner is not set, a warning calltrace is +raised in the snd_card_init() due to it. + +Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") +Signed-off-by: Hui Wang +Link: https://patch.msgid.link/20241002025659.723544-1-hui.wang@canonical.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/fsl/imx-card.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c +index 64a4d7e9db603..9c1631c444229 100644 +--- a/sound/soc/fsl/imx-card.c ++++ b/sound/soc/fsl/imx-card.c +@@ -731,6 +731,7 @@ static int imx_card_probe(struct platform_device *pdev) + + data->plat_data = plat_data; + data->card.dev = &pdev->dev; ++ data->card.owner = THIS_MODULE; + + dev_set_drvdata(&pdev->dev, &data->card); + snd_soc_card_set_drvdata(&data->card, data); +-- +2.43.0 + diff --git a/queue-6.1/bluetooth-hci_sock-fix-not-validating-setsockopt-use.patch b/queue-6.1/bluetooth-hci_sock-fix-not-validating-setsockopt-use.patch new file mode 100644 index 00000000000..a512ef24e1b --- /dev/null +++ b/queue-6.1/bluetooth-hci_sock-fix-not-validating-setsockopt-use.patch @@ -0,0 +1,78 @@ +From 33c1a4a298fb7806f014068cb6d78ca2c4adc45c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 5 Apr 2024 16:46:50 -0400 +Subject: Bluetooth: hci_sock: Fix not validating setsockopt user input + +From: Luiz Augusto von Dentz + +[ Upstream commit b2186061d6043d6345a97100460363e990af0d46 ] + +Check user input length before copying data. + +Fixes: 09572fca7223 ("Bluetooth: hci_sock: Add support for BT_{SND,RCV}BUF") +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + net/bluetooth/hci_sock.c | 21 ++++++++------------- + 1 file changed, 8 insertions(+), 13 deletions(-) + +diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c +index 730e569cae36d..e7ec68fa3ad3c 100644 +--- a/net/bluetooth/hci_sock.c ++++ b/net/bluetooth/hci_sock.c +@@ -1883,10 +1883,9 @@ static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname, + + switch (optname) { + case HCI_DATA_DIR: +- if (copy_from_sockptr(&opt, optval, sizeof(opt))) { +- err = -EFAULT; ++ err = bt_copy_from_sockptr(&opt, sizeof(opt), optval, len); ++ if (err) + break; +- } + + if (opt) + hci_pi(sk)->cmsg_mask |= HCI_CMSG_DIR; +@@ -1895,10 +1894,9 @@ static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname, + break; + + case HCI_TIME_STAMP: +- if (copy_from_sockptr(&opt, optval, sizeof(opt))) { +- err = -EFAULT; ++ err = bt_copy_from_sockptr(&opt, sizeof(opt), optval, len); ++ if (err) + break; +- } + + if (opt) + hci_pi(sk)->cmsg_mask |= HCI_CMSG_TSTAMP; +@@ -1916,11 +1914,9 @@ static int hci_sock_setsockopt_old(struct socket *sock, int level, int optname, + uf.event_mask[1] = *((u32 *) f->event_mask + 1); + } + +- len = min_t(unsigned int, len, sizeof(uf)); +- if (copy_from_sockptr(&uf, optval, len)) { +- err = -EFAULT; ++ err = bt_copy_from_sockptr(&uf, sizeof(uf), optval, len); ++ if (err) + break; +- } + + if (!capable(CAP_NET_RAW)) { + uf.type_mask &= hci_sec_filter.type_mask; +@@ -1979,10 +1975,9 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, + goto done; + } + +- if (copy_from_sockptr(&opt, optval, sizeof(opt))) { +- err = -EFAULT; ++ err = bt_copy_from_sockptr(&opt, sizeof(opt), optval, len); ++ if (err) + break; +- } + + hci_pi(sk)->mtu = opt; + break; +-- +2.43.0 + diff --git a/queue-6.1/f2fs-require-fmode_write-for-atomic-write-ioctls.patch b/queue-6.1/f2fs-require-fmode_write-for-atomic-write-ioctls.patch new file mode 100644 index 00000000000..d67378cb947 --- /dev/null +++ b/queue-6.1/f2fs-require-fmode_write-for-atomic-write-ioctls.patch @@ -0,0 +1,77 @@ +From 9d34bec0f710f7f3510130d4b55cf012ea674bb4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 4 Oct 2024 19:34:41 +0000 +Subject: f2fs: Require FMODE_WRITE for atomic write ioctls + +From: Jann Horn + +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 +Reviewed-by: Chao Yu +Reviewed-by: Eric Biggers +Signed-off-by: Jaegeuk Kim +Signed-off-by: Eric Biggers +Signed-off-by: Sasha Levin +--- + fs/f2fs/file.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c +index 1e1f640bf1c5c..6a2b5fcbe6799 100644 +--- a/fs/f2fs/file.c ++++ b/fs/f2fs/file.c +@@ -2108,6 +2108,9 @@ static int f2fs_ioc_start_atomic_write(struct file *filp) + loff_t isize; + int ret; + ++ if (!(filp->f_mode & FMODE_WRITE)) ++ return -EBADF; ++ + if (!inode_owner_or_capable(mnt_userns, inode)) + return -EACCES; + +@@ -2209,6 +2212,9 @@ static int f2fs_ioc_commit_atomic_write(struct file *filp) + struct user_namespace *mnt_userns = file_mnt_user_ns(filp); + int ret; + ++ if (!(filp->f_mode & FMODE_WRITE)) ++ return -EBADF; ++ + if (!inode_owner_or_capable(mnt_userns, inode)) + return -EACCES; + +@@ -2241,6 +2247,9 @@ static int f2fs_ioc_abort_atomic_write(struct file *filp) + struct user_namespace *mnt_userns = file_mnt_user_ns(filp); + int ret; + ++ if (!(filp->f_mode & FMODE_WRITE)) ++ return -EBADF; ++ + if (!inode_owner_or_capable(mnt_userns, inode)) + return -EACCES; + +-- +2.43.0 + diff --git a/queue-6.1/i2c-xiic-improve-error-message-when-transfer-fails-t.patch b/queue-6.1/i2c-xiic-improve-error-message-when-transfer-fails-t.patch new file mode 100644 index 00000000000..c2b0fbc4afb --- /dev/null +++ b/queue-6.1/i2c-xiic-improve-error-message-when-transfer-fails-t.patch @@ -0,0 +1,72 @@ +From 66d15323b9407bf24884723e3e1f894255d7d01e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 May 2024 12:03:24 -0400 +Subject: i2c: xiic: improve error message when transfer fails to start + +From: Marc Ferland + +[ Upstream commit ee1691d0ae103ba7fd9439800ef454674fadad27 ] + +xiic_start_xfer can fail for different reasons: + +- EBUSY: bus is busy or i2c messages still in tx_msg or rx_msg +- ETIMEDOUT: timed-out trying to clear the RX fifo +- EINVAL: wrong clock settings + +Both EINVAL and ETIMEDOUT will currently print a specific error +message followed by a generic one, for example: + + Failed to clear rx fifo + Error xiic_start_xfer + +however EBUSY will simply output the generic message: + + Error xiic_start_xfer + +which is not really helpful. + +This commit adds a new error message when a busy condition is detected +and also removes the generic message since it does not provide any +relevant information to the user. + +Signed-off-by: Marc Ferland +Acked-by: Michal Simek +Signed-off-by: Andi Shyti +Stable-dep-of: 1d4a1adbed25 ("i2c: xiic: Try re-initialization on bus busy timeout") +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-xiic.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c +index b27bfc7765993..f5dc33b4576ed 100644 +--- a/drivers/i2c/busses/i2c-xiic.c ++++ b/drivers/i2c/busses/i2c-xiic.c +@@ -673,8 +673,11 @@ static int xiic_start_xfer(struct xiic_i2c *i2c, struct i2c_msg *msgs, int num) + mutex_lock(&i2c->lock); + + ret = xiic_busy(i2c); +- if (ret) ++ if (ret) { ++ dev_err(i2c->adap.dev.parent, ++ "cannot start a transfer while busy\n"); + goto out; ++ } + + i2c->tx_msg = msgs; + i2c->rx_msg = NULL; +@@ -704,10 +707,8 @@ static int xiic_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) + return err; + + err = xiic_start_xfer(i2c, msgs, num); +- if (err < 0) { +- dev_err(adap->dev.parent, "Error xiic_start_xfer\n"); ++ if (err < 0) + goto out; +- } + + err = wait_for_completion_timeout(&i2c->completion, XIIC_XFER_TIMEOUT); + mutex_lock(&i2c->lock); +-- +2.43.0 + diff --git a/queue-6.1/i2c-xiic-try-re-initialization-on-bus-busy-timeout.patch b/queue-6.1/i2c-xiic-try-re-initialization-on-bus-busy-timeout.patch new file mode 100644 index 00000000000..e7e281a2cf7 --- /dev/null +++ b/queue-6.1/i2c-xiic-try-re-initialization-on-bus-busy-timeout.patch @@ -0,0 +1,105 @@ +From 17b8b254b81ef485c97f5bb05e3aac8fa7ed5496 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Sep 2024 22:16:53 +0200 +Subject: i2c: xiic: Try re-initialization on bus busy timeout + +From: Robert Hancock + +[ Upstream commit 1d4a1adbed2582444aaf97671858b7d12915bd05 ] + +In the event that the I2C bus was powered down when the I2C controller +driver loads, or some spurious pulses occur on the I2C bus, it's +possible that the controller detects a spurious I2C "start" condition. +In this situation it may continue to report the bus is busy indefinitely +and block the controller from working. + +The "single-master" DT flag can be specified to disable bus busy checks +entirely, but this may not be safe to use in situations where other I2C +masters may potentially exist. + +In the event that the controller reports "bus busy" for too long when +starting a transaction, we can try reinitializing the controller to see +if the busy condition clears. This allows recovering from this scenario. + +Fixes: e1d5b6598cdc ("i2c: Add support for Xilinx XPS IIC Bus Interface") +Signed-off-by: Robert Hancock +Cc: # v2.6.34+ +Reviewed-by: Manikanta Guntupalli +Acked-by: Michal Simek +Signed-off-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-xiic.c | 41 ++++++++++++++++++++++------------- + 1 file changed, 26 insertions(+), 15 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c +index f5dc33b4576ed..678707731b9c2 100644 +--- a/drivers/i2c/busses/i2c-xiic.c ++++ b/drivers/i2c/busses/i2c-xiic.c +@@ -548,23 +548,11 @@ static int xiic_bus_busy(struct xiic_i2c *i2c) + return (sr & XIIC_SR_BUS_BUSY_MASK) ? -EBUSY : 0; + } + +-static int xiic_busy(struct xiic_i2c *i2c) ++static int xiic_wait_not_busy(struct xiic_i2c *i2c) + { + int tries = 3; + int err; + +- if (i2c->tx_msg || i2c->rx_msg) +- return -EBUSY; +- +- /* In single master mode bus can only be busy, when in use by this +- * driver. If the register indicates bus being busy for some reason we +- * should ignore it, since bus will never be released and i2c will be +- * stuck forever. +- */ +- if (i2c->singlemaster) { +- return 0; +- } +- + /* for instance if previous transfer was terminated due to TX error + * it might be that the bus is on it's way to become available + * give it at most 3 ms to wake +@@ -672,13 +660,36 @@ static int xiic_start_xfer(struct xiic_i2c *i2c, struct i2c_msg *msgs, int num) + + mutex_lock(&i2c->lock); + +- ret = xiic_busy(i2c); +- if (ret) { ++ if (i2c->tx_msg || i2c->rx_msg) { + dev_err(i2c->adap.dev.parent, + "cannot start a transfer while busy\n"); ++ ret = -EBUSY; + goto out; + } + ++ /* In single master mode bus can only be busy, when in use by this ++ * driver. If the register indicates bus being busy for some reason we ++ * should ignore it, since bus will never be released and i2c will be ++ * stuck forever. ++ */ ++ if (!i2c->singlemaster) { ++ ret = xiic_wait_not_busy(i2c); ++ if (ret) { ++ /* If the bus is stuck in a busy state, such as due to spurious low ++ * pulses on the bus causing a false start condition to be detected, ++ * then try to recover by re-initializing the controller and check ++ * again if the bus is still busy. ++ */ ++ dev_warn(i2c->adap.dev.parent, "I2C bus busy timeout, reinitializing\n"); ++ ret = xiic_reinit(i2c); ++ if (ret) ++ goto out; ++ ret = xiic_wait_not_busy(i2c); ++ if (ret) ++ goto out; ++ } ++ } ++ + i2c->tx_msg = msgs; + i2c->rx_msg = NULL; + i2c->nmsgs = num; +-- +2.43.0 + diff --git a/queue-6.1/loop-don-t-set-queue_flag_nomerges.patch b/queue-6.1/loop-don-t-set-queue_flag_nomerges.patch new file mode 100644 index 00000000000..c8e5660a348 --- /dev/null +++ b/queue-6.1/loop-don-t-set-queue_flag_nomerges.patch @@ -0,0 +1,67 @@ +From 37d57e44d7f4ff0237d7efe74454f56ca05b7a89 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 14:49:11 +0200 +Subject: loop: don't set QUEUE_FLAG_NOMERGES + +From: Christoph Hellwig + +[ Upstream commit 667ea36378cf7f669044b27871c496e1559c872a ] + +QUEUE_FLAG_NOMERGES isn't really a driver interface, but a user tunable. +There also isn't any good reason to set it in the loop driver. + +The original commit adding it (5b5e20f421c0b6d "block: loop: set +QUEUE_FLAG_NOMERGES for request queue of loop") claims that "It doesn't +make sense to enable merge because the I/O submitted to backing file is +handled page by page." which of course isn't true for multi-page bvec +now, and it never has been for direct I/O, for which commit 40326d8a33d +("block/loop: allow request merge for directio mode") alredy disabled +the nomerges flag. + +Signed-off-by: Christoph Hellwig +Reviewed-by: Bart Van Assche +Link: https://lore.kernel.org/r/20240627124926.512662-2-hch@lst.de +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/loop.c | 15 ++------------- + 1 file changed, 2 insertions(+), 13 deletions(-) + +diff --git a/drivers/block/loop.c b/drivers/block/loop.c +index 12ff6f58b8a90..041d307a2f280 100644 +--- a/drivers/block/loop.c ++++ b/drivers/block/loop.c +@@ -211,13 +211,10 @@ static void __loop_update_dio(struct loop_device *lo, bool dio) + if (lo->lo_state == Lo_bound) + blk_mq_freeze_queue(lo->lo_queue); + lo->use_dio = use_dio; +- if (use_dio) { +- blk_queue_flag_clear(QUEUE_FLAG_NOMERGES, lo->lo_queue); ++ if (use_dio) + lo->lo_flags |= LO_FLAGS_DIRECT_IO; +- } else { +- blk_queue_flag_set(QUEUE_FLAG_NOMERGES, lo->lo_queue); ++ else + lo->lo_flags &= ~LO_FLAGS_DIRECT_IO; +- } + if (lo->lo_state == Lo_bound) + blk_mq_unfreeze_queue(lo->lo_queue); + } +@@ -2034,14 +2031,6 @@ static int loop_add(int i) + + blk_queue_max_hw_sectors(lo->lo_queue, BLK_DEF_MAX_SECTORS); + +- /* +- * By default, we do buffer IO, so it doesn't make sense to enable +- * merge because the I/O submitted to backing file is handled page by +- * page. For directio mode, merge does help to dispatch bigger request +- * to underlayer disk. We will enable merge once directio is enabled. +- */ +- blk_queue_flag_set(QUEUE_FLAG_NOMERGES, lo->lo_queue); +- + /* + * Disable partition scanning by default. The in-kernel partition + * scanning can be requested individually per-device during its +-- +2.43.0 + diff --git a/queue-6.1/media-usbtv-remove-useless-locks-in-usbtv_video_free.patch b/queue-6.1/media-usbtv-remove-useless-locks-in-usbtv_video_free.patch new file mode 100644 index 00000000000..e23044bf729 --- /dev/null +++ b/queue-6.1/media-usbtv-remove-useless-locks-in-usbtv_video_free.patch @@ -0,0 +1,55 @@ +From 97b019f649ebe63be1de2a9d415f4d712494dbf0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 2 Mar 2024 11:37:08 +0100 +Subject: media: usbtv: Remove useless locks in usbtv_video_free() + +From: Benjamin Gaignard + +[ Upstream commit 65e6a2773d655172143cc0b927cdc89549842895 ] + +Remove locks calls in usbtv_video_free() because +are useless and may led to a deadlock as reported here: +https://syzkaller.appspot.com/x/bisect.txt?x=166dc872180000 +Also remove usbtv_stop() call since it will be called when +unregistering the device. + +Before 'c838530d230b' this issue would only be noticed if you +disconnect while streaming and now it is noticeable even when +disconnecting while not streaming. + +Fixes: c838530d230b ("media: media videobuf2: Be more flexible on the number of queue stored buffers") +Fixes: f3d27f34fdd7 ("[media] usbtv: Add driver for Fushicai USBTV007 video frame grabber") + +Signed-off-by: Benjamin Gaignard +Reviewed-by: Tomasz Figa +Tested-by: Hans Verkuil +Signed-off-by: Hans Verkuil +[hverkuil: fix minor spelling mistake in log message] +Signed-off-by: Sasha Levin +--- + drivers/media/usb/usbtv/usbtv-video.c | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c +index 1e30e05953dc6..7495df6b51912 100644 +--- a/drivers/media/usb/usbtv/usbtv-video.c ++++ b/drivers/media/usb/usbtv/usbtv-video.c +@@ -962,15 +962,8 @@ int usbtv_video_init(struct usbtv *usbtv) + + void usbtv_video_free(struct usbtv *usbtv) + { +- mutex_lock(&usbtv->vb2q_lock); +- mutex_lock(&usbtv->v4l2_lock); +- +- usbtv_stop(usbtv); + vb2_video_unregister_device(&usbtv->vdev); + v4l2_device_disconnect(&usbtv->v4l2_dev); + +- mutex_unlock(&usbtv->v4l2_lock); +- mutex_unlock(&usbtv->vb2q_lock); +- + v4l2_device_put(&usbtv->v4l2_dev); + } +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index 2e2ed93275c..6f67705d44d 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -406,3 +406,15 @@ ppp-do-not-assume-bh-is-held-in-ppp_channel_bridge_i.patch fsdax-xfs-port-unshare-to-fsdax.patch iomap-constrain-the-file-range-passed-to-iomap_file_.patch sctp-set-sk_state-back-to-closed-if-autobind-fails-i.patch +i2c-xiic-improve-error-message-when-transfer-fails-t.patch +i2c-xiic-try-re-initialization-on-bus-busy-timeout.patch +loop-don-t-set-queue_flag_nomerges.patch +bluetooth-hci_sock-fix-not-validating-setsockopt-use.patch +media-usbtv-remove-useless-locks-in-usbtv_video_free.patch +asoc-atmel-mchp-pdmc-skip-alsa-restoration-if-substr.patch +alsa-mixer_oss-remove-some-incorrect-kfree_const-usa.patch +alsa-hda-realtek-fix-the-push-button-function-for-th.patch +alsa-hda-generic-unconditionally-prefer-preferred_da.patch +asoc-imx-card-set-card.owner-to-avoid-a-warning-call.patch +alsa-hda-conexant-fix-conflicting-quirk-for-system76.patch +f2fs-require-fmode_write-for-atomic-write-ioctls.patch