forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
If the RTOS is premptive, BusDisplay has a race condition that may caused faults on shared buses. displayio_display_bus_begin_transaction may return false indicating that the lock could not be acquired. As _refresh_area does not respect the return value of displayio_display_bus_begin_transaction, _send_pixels will try to write to the bus without a lock. A guard is present in the code, but it is implemented in a way that is not thread safe.
circuitpython/shared-module/busdisplay/BusDisplay.c
Lines 290 to 297 in 117b5d1
| // Can't acquire display bus; skip the rest of the data. | |
| if (!displayio_display_bus_is_free(&self->bus)) { | |
| return false; | |
| } | |
| displayio_display_bus_begin_transaction(&self->bus); | |
| _send_pixels(self, (uint8_t *)buffer, subrectangle_size_bytes); | |
| displayio_display_bus_end_transaction(&self->bus); |
This is likely responsible for issue #10536.