From 824e85669543cb7215b54f1c6fc0ba05e798b088 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 6 Jun 2024 15:04:23 +0200 Subject: [PATCH] 6.6-stable patches added patches: alsa-timer-set-lower-bound-of-start-tick-time.patch --- ...r-set-lower-bound-of-start-tick-time.patch | 53 +++++++++++++++++++ queue-6.6/series | 1 + 2 files changed, 54 insertions(+) create mode 100644 queue-6.6/alsa-timer-set-lower-bound-of-start-tick-time.patch diff --git a/queue-6.6/alsa-timer-set-lower-bound-of-start-tick-time.patch b/queue-6.6/alsa-timer-set-lower-bound-of-start-tick-time.patch new file mode 100644 index 00000000000..cd4505a2eb7 --- /dev/null +++ b/queue-6.6/alsa-timer-set-lower-bound-of-start-tick-time.patch @@ -0,0 +1,53 @@ +From 4a63bd179fa8d3fcc44a0d9d71d941ddd62f0c4e Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 14 May 2024 20:27:36 +0200 +Subject: ALSA: timer: Set lower bound of start tick time + +From: Takashi Iwai + +commit 4a63bd179fa8d3fcc44a0d9d71d941ddd62f0c4e upstream. + +Currently ALSA timer doesn't have the lower limit of the start tick +time, and it allows a very small size, e.g. 1 tick with 1ns resolution +for hrtimer. Such a situation may lead to an unexpected RCU stall, +where the callback repeatedly queuing the expire update, as reported +by fuzzer. + +This patch introduces a sanity check of the timer start tick time, so +that the system returns an error when a too small start size is set. +As of this patch, the lower limit is hard-coded to 100us, which is +small enough but can still work somehow. + +Reported-by: syzbot+43120c2af6ca2938cc38@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/r/000000000000fa00a1061740ab6d@google.com +Cc: +Link: https://lore.kernel.org/r/20240514182745.4015-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +[ backport note: the error handling is changed, as the original commit + is based on the recent cleanup with guard() in commit beb45974dd49 + -- tiwai ] +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/core/timer.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/sound/core/timer.c ++++ b/sound/core/timer.c +@@ -553,6 +553,16 @@ static int snd_timer_start1(struct snd_t + goto unlock; + } + ++ /* check the actual time for the start tick; ++ * bail out as error if it's way too low (< 100us) ++ */ ++ if (start) { ++ if ((u64)snd_timer_hw_resolution(timer) * ticks < 100000) { ++ result = -EINVAL; ++ goto unlock; ++ } ++ } ++ + if (start) + timeri->ticks = timeri->cticks = ticks; + else if (!timeri->cticks) diff --git a/queue-6.6/series b/queue-6.6/series index 815bb306c6f..665d092ca6f 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -740,3 +740,4 @@ hwmon-intel-m10-bmc-hwmon-fix-multiplier-for-n6000-b.patch hwmon-shtc1-fix-property-misspelling.patch riscv-prevent-pt_regs-corruption-for-secondary-idle-.patch alsa-seq-ump-fix-swapped-song-position-pointer-data.patch +alsa-timer-set-lower-bound-of-start-tick-time.patch -- 2.47.3