Skip to content

Commit 3a4187e

Browse files
nunojsajic23
authored andcommitted
iio: adc: ad7923: Fix buffer overflow for tx_buf and ring_xfer
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: 851644a ("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>
1 parent fa40763 commit 3a4187e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/iio/adc/ad7923.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
struct ad7923_state {
5050
struct spi_device *spi;
51-
struct spi_transfer ring_xfer[5];
51+
struct spi_transfer ring_xfer[9];
5252
struct spi_transfer scan_single_xfer[2];
5353
struct spi_message ring_msg;
5454
struct spi_message scan_single_msg;
@@ -64,7 +64,7 @@ struct ad7923_state {
6464
* Length = 8 channels + 4 extra for 8 byte timestamp
6565
*/
6666
__be16 rx_buf[12] __aligned(IIO_DMA_MINALIGN);
67-
__be16 tx_buf[4];
67+
__be16 tx_buf[8];
6868
};
6969

7070
struct ad7923_chip_info {

0 commit comments

Comments
 (0)