]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: ismt: prevent memory corruption in ismt_access()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 2 Jun 2022 11:02:18 +0000 (14:02 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Jun 2022 15:40:56 +0000 (08:40 -0700)
commite3d841227c10f99938421447cc06848737656cf3
tree59d93f4cfe6a688fbf9455c88ad2ec776955c90b
parentb29f7b08dc2495676f3917e484a2d357847333f5
i2c: ismt: prevent memory corruption in ismt_access()

The "data->block[0]" variable comes from the user and is a number
between 0-255.  It needs to be capped to prevent writing beyond the end
of dma_buffer[].

Fixes: fa6a67ed764f ("i2c: ismt: Adding support for I2C_SMBUS_BLOCK_PROC_CALL")
Reported-and-tested-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/i2c/busses/i2c-ismt.c