Skip to content

Commit c116dea

Browse files
author
Wolfram Sang
committed
i2c: testunit: discard write requests while old command is running
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: b39ab96 ("i2c: testunit: add support for block process calls") Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Andi Shyti <[email protected]>
1 parent c422b6a commit c116dea

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/i2c/i2c-slave-testunit.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ static int i2c_slave_testunit_slave_cb(struct i2c_client *client,
121121
break;
122122

123123
case I2C_SLAVE_WRITE_REQUESTED:
124+
if (test_bit(TU_FLAG_IN_PROCESS, &tu->flags))
125+
return -EBUSY;
126+
124127
memset(tu->regs, 0, TU_NUM_REGS);
125128
tu->reg_idx = 0;
126129
break;

0 commit comments

Comments
 (0)