]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c/designware: Fix an initialization issue
authorMichael J. Ruhl <michael.j.ruhl@intel.com>
Fri, 27 Jun 2025 14:35:11 +0000 (10:35 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 14:03:19 +0000 (16:03 +0200)
commit6358cb9c2a31e23b6b51bfcd7fe2b7becaf6b149
tree5e7ee5b706f9e161e2888297ed56083a097993d2
parentd8eab407c08d40908345174f27c306483c894c7b
i2c/designware: Fix an initialization issue

commit 3d30048958e0d43425f6d4e76565e6249fa71050 upstream.

The i2c_dw_xfer_init() function requires msgs and msg_write_idx from the
dev context to be initialized.

amd_i2c_dw_xfer_quirk() inits msgs and msgs_num, but not msg_write_idx.

This could allow an out of bounds access (of msgs).

Initialize msg_write_idx before calling i2c_dw_xfer_init().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
Cc: <stable@vger.kernel.org> # v5.13+
Signed-off-by: Michael J. Ruhl <michael.j.ruhl@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20250627143511.489570-1-michael.j.ruhl@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-designware-master.c