]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.4
authorSasha Levin <sashal@kernel.org>
Sat, 26 Oct 2024 15:33:12 +0000 (11:33 -0400)
committerSasha Levin <sashal@kernel.org>
Sat, 26 Oct 2024 15:33:12 +0000 (11:33 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.4/alsa-firewire-lib-avoid-division-by-zero-in-apply_co.patch [new file with mode: 0644]
queue-5.4/alsa-hda-realtek-update-default-depop-procedure.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/alsa-firewire-lib-avoid-division-by-zero-in-apply_co.patch b/queue-5.4/alsa-firewire-lib-avoid-division-by-zero-in-apply_co.patch
new file mode 100644 (file)
index 0000000..85cde0d
--- /dev/null
@@ -0,0 +1,49 @@
+From b30ed5d5b5933cf9b37aa4e216e754d5e46f8ee5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 18 Oct 2024 09:00:18 +0300
+Subject: ALSA: firewire-lib: Avoid division by zero in
+ apply_constraint_to_size()
+
+From: Andrey Shumilin <shum.sdl@nppct.ru>
+
+[ Upstream commit 72cafe63b35d06b5cfbaf807e90ae657907858da ]
+
+The step variable is initialized to zero. It is changed in the loop,
+but if it's not changed it will remain zero. Add a variable check
+before the division.
+
+The observed behavior was introduced by commit 826b5de90c0b
+("ALSA: firewire-lib: fix insufficient PCM rule for period/buffer size"),
+and it is difficult to show that any of the interval parameters will
+satisfy the snd_interval_test() condition with data from the
+amdtp_rate_table[] table.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 826b5de90c0b ("ALSA: firewire-lib: fix insufficient PCM rule for period/buffer size")
+Signed-off-by: Andrey Shumilin <shum.sdl@nppct.ru>
+Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
+Link: https://patch.msgid.link/20241018060018.1189537-1-shum.sdl@nppct.ru
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/firewire/amdtp-stream.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sound/firewire/amdtp-stream.c b/sound/firewire/amdtp-stream.c
+index 07e58dcad4afc..14a4905a777e1 100644
+--- a/sound/firewire/amdtp-stream.c
++++ b/sound/firewire/amdtp-stream.c
+@@ -164,6 +164,9 @@ static int apply_constraint_to_size(struct snd_pcm_hw_params *params,
+                       step = max(step, amdtp_syt_intervals[i]);
+       }
++      if (step == 0)
++              return -EINVAL;
++
+       t.min = roundup(s->min, step);
+       t.max = rounddown(s->max, step);
+       t.integer = 1;
+-- 
+2.43.0
+
diff --git a/queue-5.4/alsa-hda-realtek-update-default-depop-procedure.patch b/queue-5.4/alsa-hda-realtek-update-default-depop-procedure.patch
new file mode 100644 (file)
index 0000000..db1e7f8
--- /dev/null
@@ -0,0 +1,88 @@
+From 51832e5580b0481e5a07e99c5c445bbfdceaa420 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 23 Oct 2024 16:13:10 +0800
+Subject: ALSA: hda/realtek: Update default depop procedure
+
+From: Kailang Yang <kailang@realtek.com>
+
+[ Upstream commit e3ea2757c312e51bbf62ebc434a6f7df1e3a201f ]
+
+Old procedure has a chance to meet Headphone no output.
+
+Fixes: c2d6af53a43f ("ALSA: hda/realtek - Add default procedure for suspend and resume state")
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Link: https://lore.kernel.org/17b717a0a0b04a77aea4a8ec820cba13@realtek.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_realtek.c | 38 ++++++++++++++++-------------------
+ 1 file changed, 17 insertions(+), 21 deletions(-)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index f32c3c3752417..4ed7483087ee6 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3730,20 +3730,18 @@ static void alc_default_init(struct hda_codec *codec)
+       hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
+-      if (hp_pin_sense)
++      if (hp_pin_sense) {
+               msleep(2);
+-      snd_hda_codec_write(codec, hp_pin, 0,
+-                          AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+-
+-      if (hp_pin_sense)
+-              msleep(85);
++              snd_hda_codec_write(codec, hp_pin, 0,
++                                  AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+-      snd_hda_codec_write(codec, hp_pin, 0,
+-                          AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++              msleep(75);
+-      if (hp_pin_sense)
+-              msleep(100);
++              snd_hda_codec_write(codec, hp_pin, 0,
++                                  AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
++              msleep(75);
++      }
+ }
+ static void alc_default_shutup(struct hda_codec *codec)
+@@ -3759,22 +3757,20 @@ static void alc_default_shutup(struct hda_codec *codec)
+       hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
+-      if (hp_pin_sense)
++      if (hp_pin_sense) {
+               msleep(2);
+-      snd_hda_codec_write(codec, hp_pin, 0,
+-                          AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+-
+-      if (hp_pin_sense)
+-              msleep(85);
+-
+-      if (!spec->no_shutup_pins)
+               snd_hda_codec_write(codec, hp_pin, 0,
+-                                  AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++                                  AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+-      if (hp_pin_sense)
+-              msleep(100);
++              msleep(75);
++              if (!spec->no_shutup_pins)
++                      snd_hda_codec_write(codec, hp_pin, 0,
++                                          AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++
++              msleep(75);
++      }
+       alc_auto_setup_eapd(codec, false);
+       alc_shutup_pins(codec);
+ }
+-- 
+2.43.0
+
index 81ea99df32229c764dd6a3bcec8846056825f9c6..c6c38d90716d4d24391b5a7a1055675d53eada08 100644 (file)
@@ -412,3 +412,5 @@ net-usb-usbnet-fix-name-regression.patch
 net-sched-fix-use-after-free-in-taprio_change.patch
 r8169-avoid-unsolicited-interrupts.patch
 posix-clock-posix-clock-fix-unbalanced-locking-in-pc.patch
+alsa-firewire-lib-avoid-division-by-zero-in-apply_co.patch
+alsa-hda-realtek-update-default-depop-procedure.patch