From: Greg Kroah-Hartman Date: Tue, 2 Jul 2024 09:18:59 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.19.317~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=313e652c49aa19ae02ba17fc7e7fd9b09f754d21;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: pwm-stm32-refuse-too-small-period-requests.patch --- diff --git a/queue-4.19/pwm-stm32-refuse-too-small-period-requests.patch b/queue-4.19/pwm-stm32-refuse-too-small-period-requests.patch new file mode 100644 index 00000000000..6b04528d955 --- /dev/null +++ b/queue-4.19/pwm-stm32-refuse-too-small-period-requests.patch @@ -0,0 +1,42 @@ +From c45fcf46ca2368dafe7e5c513a711a6f0f974308 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= +Date: Fri, 21 Jun 2024 16:37:12 +0200 +Subject: pwm: stm32: Refuse too small period requests +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +commit c45fcf46ca2368dafe7e5c513a711a6f0f974308 upstream. + +If period_ns is small, prd might well become 0. Catch that case because +otherwise with + + regmap_write(priv->regmap, TIM_ARR, prd - 1); + +a few lines down quite a big period is configured. + +Fixes: 7edf7369205b ("pwm: Add driver for STM32 plaftorm") +Cc: stable@vger.kernel.org +Reviewed-by: Trevor Gamblin +Signed-off-by: Uwe Kleine-König +Link: https://lore.kernel.org/r/b86f62f099983646f97eeb6bfc0117bb2d0c340d.1718979150.git.u.kleine-koenig@baylibre.com +Signed-off-by: Uwe Kleine-König +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pwm/pwm-stm32.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/pwm/pwm-stm32.c ++++ b/drivers/pwm/pwm-stm32.c +@@ -337,6 +337,9 @@ static int stm32_pwm_config(struct stm32 + + prd = div; + ++ if (!prd) ++ return -EINVAL; ++ + if (prescaler > MAX_TIM_PSC) + return -EINVAL; + diff --git a/queue-4.19/series b/queue-4.19/series index 581d09ef15c..81da71e49bb 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -144,3 +144,4 @@ drm-nouveau-dispnv04-fix-null-pointer-dereference-in-nv17_tv_get_hd_modes.patch batman-adv-don-t-accept-tt-entries-for-out-of-spec-vids.patch ata-libata-core-fix-double-free-on-error.patch ftruncate-pass-a-signed-offset.patch +pwm-stm32-refuse-too-small-period-requests.patch