Skip to content

Commit

Permalink
i2c: designware: Synchronize IRQs when unregistering slave client
Browse files Browse the repository at this point in the history
Make sure interrupt handler i2c_dw_irq_handler_slave() has finished
before clearing the the dev->slave pointer in i2c_dw_unreg_slave().

There is possibility for a race if i2c_dw_irq_handler_slave() is running
on another CPU while clearing the dev->slave pointer.

Reported-by: Krzysztof Adamski <[email protected]>
Reported-by: Wolfram Sang <[email protected]>
Signed-off-by: Jarkko Nikula <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
jhnikula authored and Wolfram Sang committed Aug 29, 2019
1 parent 01641b2 commit c486dcd
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/i2c/busses/i2c-designware-slave.c
Original file line number Diff line number Diff line change
@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)

dev->disable_int(dev);
dev->disable(dev);
synchronize_irq(dev->irq);
dev->slave = NULL;
pm_runtime_put(dev->dev);

0 comments on commit c486dcd

Please sign in to comment.