]> 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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Jun 2022 06:43:37 +0000 (08:43 +0200)
commit58b9f5e8ad85e493dbafb6a7543c1a3556071144
treeafb11cf16524c0a0d6b99c1dfd534ee615d726da
parent83c90d77375dab7714eefc70f4923b366e9f7f18
i2c: ismt: prevent memory corruption in ismt_access()

commit 146527d1a039a392e94bea128f69d606000d086d upstream.

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: 3fa315911c01 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-ismt.c