From: Greg Kroah-Hartman Date: Fri, 6 Dec 2024 12:08:45 +0000 (+0100) Subject: 5.4-stable patches X-Git-Tag: v6.6.64~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e2574dea595e3e99e61a4231b570ff5f718f912;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: ad7780-fix-division-by-zero-in-ad7780_write_raw.patch --- diff --git a/queue-5.4/ad7780-fix-division-by-zero-in-ad7780_write_raw.patch b/queue-5.4/ad7780-fix-division-by-zero-in-ad7780_write_raw.patch new file mode 100644 index 00000000000..cb066480a93 --- /dev/null +++ b/queue-5.4/ad7780-fix-division-by-zero-in-ad7780_write_raw.patch @@ -0,0 +1,35 @@ +From c174b53e95adf2eece2afc56cd9798374919f99a Mon Sep 17 00:00:00 2001 +From: Zicheng Qu +Date: Mon, 28 Oct 2024 14:20:27 +0000 +Subject: ad7780: fix division by zero in ad7780_write_raw() + +From: Zicheng Qu + +commit c174b53e95adf2eece2afc56cd9798374919f99a upstream. + +In the ad7780_write_raw() , val2 can be zero, which might lead to a +division by zero error in DIV_ROUND_CLOSEST(). The ad7780_write_raw() +is based on iio_info's write_raw. While val is explicitly declared that +can be zero (in read mode), val2 is not specified to be non-zero. + +Fixes: 9085daa4abcc ("staging: iio: ad7780: add gain & filter gpio support") +Cc: stable@vger.kernel.org +Signed-off-by: Zicheng Qu +Link: https://patch.msgid.link/20241028142027.1032332-1-quzicheng@huawei.com +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/ad7780.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/adc/ad7780.c ++++ b/drivers/iio/adc/ad7780.c +@@ -152,7 +152,7 @@ static int ad7780_write_raw(struct iio_d + + switch (m) { + case IIO_CHAN_INFO_SCALE: +- if (val != 0) ++ if (val != 0 || val2 == 0) + return -EINVAL; + + vref = st->int_vref_mv * 1000000LL; diff --git a/queue-5.4/series b/queue-5.4/series index 288fd3d4644..cf5ce71e3eb 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -211,3 +211,4 @@ media-platform-allegro-dvt-fix-possible-memory-leak-in-allocate_buffers_internal ovl-filter-invalid-inodes-with-missing-lookup-function.patch ftrace-fix-regression-with-module-command-in-stack_trace_filter.patch clk-qcom-gcc-qcs404-fix-initial-rate-of-gpll3.patch +ad7780-fix-division-by-zero-in-ad7780_write_raw.patch