linux-stable/drivers/i2c
Robert Hancock ce5311e79e i2c: xiic: Don't try to handle more interrupt events after error
[ Upstream commit cb6e45c9a0 ]

In xiic_process, it is possible that error events such as arbitration
lost or TX error can be raised in conjunction with other interrupt flags
such as TX FIFO empty or bus not busy. Error events result in the
controller being reset and the error returned to the calling request,
but the function could potentially try to keep handling the other
events, such as by writing more messages into the TX FIFO. Since the
transaction has already failed, this is not helpful and will just cause
issues.

This problem has been present ever since:

commit 7f9906bd7f ("i2c: xiic: Service all interrupts in isr")

which allowed non-error events to be handled after errors, but became
more obvious after:

commit 743e227a89 ("i2c: xiic: Defer xiic_wakeup() and
__xiic_start_xfer() in xiic_process()")

which reworked the code to add a WARN_ON which triggers if both the
xfer_more and wakeup_req flags were set, since this combination is
not supposed to happen, but was occurring in this scenario.

Skip further interrupt handling after error flags are detected to avoid
this problem.

Fixes: 7f9906bd7f ("i2c: xiic: Service all interrupts in isr")
Signed-off-by: Robert Hancock <robert.hancock@calian.com>
Acked-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-08-11 11:45:14 +02:00
..
algos i2c: algo: pca: Reapply i2c bus settings after reset 2020-09-23 12:10:59 +02:00
busses i2c: xiic: Don't try to handle more interrupt events after error 2023-08-11 11:45:14 +02:00
muxes i2c: mux-gpmux: Add of_node_put() when breaking out of loop 2022-08-25 11:15:11 +02:00
Kconfig
Makefile
i2c-boardinfo.c
i2c-core-acpi.c i2c: acpi: fix resource leak in reconfiguration device addition 2021-10-13 10:10:52 +02:00
i2c-core-base.c i2c: Fix a potential use after free 2022-08-25 11:15:04 +02:00
i2c-core-of.c i2c: core: fix use after free in of_i2c_notify 2019-12-13 08:51:07 +01:00
i2c-core-slave.c i2c: slave: add sanity check when unregistering 2020-08-11 15:32:33 +02:00
i2c-core-smbus.c i2c: core: check returned size of emulated smbus block read 2020-06-30 23:17:13 -04:00
i2c-core.h
i2c-dev.c i2c: validate user data in compat ioctl 2022-01-05 12:34:59 +01:00
i2c-mux.c
i2c-slave-eeprom.c
i2c-smbus.c
i2c-stub.c