i2c/designware: Fix an initialization issue
Subsystems (4)
PATCH 1/1 i2c/designware: Fix an initialization issue
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 <[email protected]>
Fixes 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
Cc <[email protected]>
Signed-off-by Michael J. Ruhl <[email protected]>
--- drivers/i2c/busses/i2c-designware-master.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/busses/i2c-designware-master.c +1 -0
@@ -363,6 +363,7 @@ static int amd_i2c_dw_xfer_quirk(struct i2c_adapter *adap, struct i2c_msg *msgs, dev->msgs = msgs; dev->msgs_num = num_msgs; + dev->msg_write_idx =0 ;i2c_dw_xfer_init (dev);/* Initiate messages read/write transaction */
Signature · 1 line
2.49.0
Hi Michael,
Quoted 5 lines · Michael J. Ruhl
The
i2c_dw_xfer_init()function requires msgs andmsg_write_idxfrom the dev context to be initialized.
amd_i2c_dw_xfer_quirk()inits msgs andmsgs_num, but notmsg_write_idx.
Quoted 8 lines
This could allow an out of bounds access (of msgs).
Initialize
msg_write_idxbefore callingi2c_dw_xfer_init().Reviewed-by Andy Shevchenko <[email protected]>Fixes 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")Cc <[email protected]>Signed-off-by Michael J. Ruhl <[email protected]>
merged to i2c/i2c-host-fixes.
Thank you,
Andi