]> git.itanic.dy.fi Git - linux-stable/commit
i2c: mlxbf: prevent stack overflow in mlxbf_i2c_smbus_start_transaction()
authorAsmaa Mnebhi <asmaa@nvidia.com>
Thu, 8 Sep 2022 17:35:39 +0000 (13:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 09:10:40 +0000 (11:10 +0200)
commit48ee0a864d1af02eea98fc825cc230d61517a71e
tree87d332c22d04f849126cc2d30e50b2de3746da87
parent4f6db1f9219e8b122da64342b7daaf12eb8e8de2
i2c: mlxbf: prevent stack overflow in mlxbf_i2c_smbus_start_transaction()

[ Upstream commit de24aceb07d426b6f1c59f33889d6a964770547b ]

memcpy() is called in a loop while 'operation->length' upper bound
is not checked and 'data_idx' also increments.

Fixes: b5b5b32081cd206b ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reviewed-by: Khalil Blaiech <kblaiech@nvidia.com>
Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-mlxbf.c