linux/drivers/i2c
Wolfram Sang c7c9e914f9 i2c: rcar: avoid race when unregistering slave
Due to the lockless design of the driver, it is theoretically possible
to access a NULL pointer, if a slave interrupt was running while we were
unregistering the slave. To make this rock solid, disable the interrupt
for a short time while we are clearing the interrupt_enable register.
This patch is purely based on code inspection. The OOPS is super-hard to
trigger because clearing SAR (the address) makes interrupts even more
unlikely to happen as well. While here, reinit SCR to SDBS because this
bit should always be set according to documentation. There is no effect,
though, because the interface is disabled.

Fixes: 7b814d852a ("i2c: rcar: avoid race when unregistering slave client")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2020-07-31 15:56:32 +02:00
..
algos Linux 5.8-rc7 2020-07-31 15:54:27 +02:00
busses i2c: rcar: avoid race when unregistering slave 2020-07-31 15:56:32 +02:00
muxes Merge branch 'i2c/for-current-fixed' into i2c/for-5.8 2020-05-20 15:27:45 +02:00
i2c-boardinfo.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-core-acpi.c i2c: acpi: Drop double check for ACPI companion device 2020-05-28 18:01:20 +02:00
i2c-core-base.c i2c: core: do not use logical device when creating irq domain 2020-07-27 22:31:16 +02:00
i2c-core-of.c i2c: use my kernel.org address from now on 2020-05-05 16:29:09 +02:00
i2c-core-slave.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
i2c-core-smbus.c i2c: core: check returned size of emulated smbus block read 2020-06-26 10:18:35 +02:00
i2c-core.h i2c: reword explanation about atomic transfers 2020-05-20 15:25:55 +02:00
i2c-dev.c i2c: Use separate MODULE_AUTHOR() statements for multiple authors 2020-07-04 08:25:13 +02:00
i2c-mux.c i2c: mux: add sysfs header 2019-06-22 07:32:33 +02:00
i2c-slave-eeprom.c i2c: busses: Use fallthrough pseudo-keyword 2020-07-23 22:04:08 +02:00
i2c-smbus.c i2c: smbus: Add a way to instantiate SPD EEPROMs automatically 2020-05-29 12:53:04 +02:00
i2c-stub.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
Kconfig i2c: add Kconfig help text for slave mode 2020-07-04 08:17:53 +02:00
Makefile i2c: don't use any __deprecated handling anymore 2018-08-24 17:26:43 +02:00