mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
i2c: testunit: discard write requests while old command is running
[ Upstream commit c116deafd1a5cc1e9739099eb32114e90623209c ]
When clearing registers on new write requests was added, the protection
for currently running commands was missed leading to concurrent access
to the testunit registers. Check the flag beforehand.
Fixes: b39ab96aa8 ("i2c: testunit: add support for block process calls")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
86826b1ffd
commit
274239d9f8
@@ -121,6 +121,9 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case I2C_SLAVE_WRITE_REQUESTED:
|
case I2C_SLAVE_WRITE_REQUESTED:
|
||||||
|
if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags))
|
||||||
|
return -EBUSY;
|
||||||
|
|
||||||
memset(tu->regs, 0, TU_NUM_REGS);
|
memset(tu->regs, 0, TU_NUM_REGS);
|
||||||
tu->reg_idx = 0;
|
tu->reg_idx = 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user