* [PATCH 5.15.y] iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer
@ 2026-04-09 6:51 Robert Garcia
2026-04-20 18:17 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Robert Garcia @ 2026-04-09 6:51 UTC (permalink / raw)
To: stable, Nuno Sa
Cc: Jonathan Cameron, Robert Garcia, Zicheng Qu, Lars-Peter Clausen,
Michael Hennerich, Daniel Junho, Alexandru Ardelean, linux-iio,
linux-kernel
From: Nuno Sa <nuno.sa@analog.com>
[ Upstream commit 3a4187ec454e19903fd15f6e1825a4b84e59a4cd ]
The AD7923 was updated to support devices with 8 channels, but the size
of tx_buf and ring_xfer was not increased accordingly, leading to a
potential buffer overflow in ad7923_update_scan_mode().
Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928")
Cc: stable@vger.kernel.org
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
Link: https://patch.msgid.link/20241029134637.2261336-1-quzicheng@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
[ Context change fixed. ]
Signed-off-by: Robert Garcia <rob_garcia@163.com>
---
drivers/iio/adc/ad7923.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index b8cc94b7dd80..a8e59fd2dcf3 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -47,7 +47,7 @@
struct ad7923_state {
struct spi_device *spi;
- struct spi_transfer ring_xfer[5];
+ struct spi_transfer ring_xfer[9];
struct spi_transfer scan_single_xfer[2];
struct spi_message ring_msg;
struct spi_message scan_single_msg;
@@ -63,7 +63,7 @@ struct ad7923_state {
* Length = 8 channels + 4 extra for 8 byte timestamp
*/
__be16 rx_buf[12] ____cacheline_aligned;
- __be16 tx_buf[4];
+ __be16 tx_buf[8];
};
struct ad7923_chip_info {
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 5.15.y] iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer
2026-04-09 6:51 [PATCH 5.15.y] iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer Robert Garcia
@ 2026-04-20 18:17 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2026-04-20 18:17 UTC (permalink / raw)
To: Robert Garcia
Cc: stable, Nuno Sa, Jonathan Cameron, Zicheng Qu, Lars-Peter Clausen,
Michael Hennerich, Daniel Junho, Alexandru Ardelean, linux-iio,
linux-kernel
On Thu, 9 Apr 2026 14:51:47 +0800
Robert Garcia <rob_garcia@163.com> wrote:
> From: Nuno Sa <nuno.sa@analog.com>
>
> [ Upstream commit 3a4187ec454e19903fd15f6e1825a4b84e59a4cd ]
>
> The AD7923 was updated to support devices with 8 channels, but the size
> of tx_buf and ring_xfer was not increased accordingly, leading to a
> potential buffer overflow in ad7923_update_scan_mode().
>
> Fixes: 851644a60d20 ("iio: adc: ad7923: Add support for the ad7908/ad7918/ad7928")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> Signed-off-by: Zicheng Qu <quzicheng@huawei.com>
> Link: https://patch.msgid.link/20241029134637.2261336-1-quzicheng@huawei.com
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> [ Context change fixed. ]
> Signed-off-by: Robert Garcia <rob_garcia@163.com>
If it's not picked up already, then backporting as here looks fine to me.
Acked-by: Jonathan Cameron <jic23@kernel.org>
> ---
> drivers/iio/adc/ad7923.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
> index b8cc94b7dd80..a8e59fd2dcf3 100644
> --- a/drivers/iio/adc/ad7923.c
> +++ b/drivers/iio/adc/ad7923.c
> @@ -47,7 +47,7 @@
>
> struct ad7923_state {
> struct spi_device *spi;
> - struct spi_transfer ring_xfer[5];
> + struct spi_transfer ring_xfer[9];
> struct spi_transfer scan_single_xfer[2];
> struct spi_message ring_msg;
> struct spi_message scan_single_msg;
> @@ -63,7 +63,7 @@ struct ad7923_state {
> * Length = 8 channels + 4 extra for 8 byte timestamp
> */
> __be16 rx_buf[12] ____cacheline_aligned;
> - __be16 tx_buf[4];
> + __be16 tx_buf[8];
> };
>
> struct ad7923_chip_info {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-04-20 18:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-09 6:51 [PATCH 5.15.y] iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer Robert Garcia
2026-04-20 18:17 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox