Patch "ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-stm-prevent-potential-division-by-zero-in-stm32.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b1a22cd94f90f61f9317097b2bf6629f11310c08
Author: Luo Yifan <luoyifan@xxxxxxxxxxxxxxxxxxxx>
Date:   Thu Nov 7 09:59:36 2024 +0800

    ASoC: stm: Prevent potential division by zero in stm32_sai_get_clk_div()
    
    [ Upstream commit 23569c8b314925bdb70dd1a7b63cfe6100868315 ]
    
    This patch checks if div is less than or equal to zero (div <= 0). If
    div is zero or negative, the function returns -EINVAL, ensuring the
    division operation is safe to perform.
    
    Signed-off-by: Luo Yifan <luoyifan@xxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Olivier Moysan <olivier.moysan@xxxxxxxxxxx>
    Link: https://patch.msgid.link/20241107015936.211902-1-luoyifan@xxxxxxxxxxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c
index 3a7f0102b4c5c..90e4757f76b0f 100644
--- a/sound/soc/stm/stm32_sai_sub.c
+++ b/sound/soc/stm/stm32_sai_sub.c
@@ -319,7 +319,7 @@ static int stm32_sai_get_clk_div(struct stm32_sai_sub_data *sai,
 	int div;
 
 	div = DIV_ROUND_CLOSEST(input_rate, output_rate);
-	if (div > SAI_XCR1_MCKDIV_MAX(version)) {
+	if (div > SAI_XCR1_MCKDIV_MAX(version) || div <= 0) {
 		dev_err(&sai->pdev->dev, "Divider %d out of range\n", div);
 		return -EINVAL;
 	}




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux