Commit 65ad72ce authored by Jarkko Nikula's avatar Jarkko Nikula Committed by Greg Kroah-Hartman

i2c: designware: Synchronize IRQs when unregistering slave client

[ Upstream commit c486dcd2 ]

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: default avatarKrzysztof Adamski <krzysztof.adamski@nokia.com>
Reported-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 5a45b14b
...@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave) ...@@ -94,6 +94,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
dev->disable_int(dev); dev->disable_int(dev);
dev->disable(dev); dev->disable(dev);
synchronize_irq(dev->irq);
dev->slave = NULL; dev->slave = NULL;
pm_runtime_put(dev->dev); pm_runtime_put(dev->dev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment