Skip to content

Commit 910eee3

Browse files
Wolfram Sangsmb49
authored andcommitted
i2c: testunit: discard write requests while old command is running
BugLink: https://bugs.launchpad.net/bugs/2076435 [ 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: b39ab96 ("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> Signed-off-by: Portia Stephens <portia.stephens@canonical.com> Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
1 parent 614b06a commit 910eee3

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)