KevinOConnor / can2040

Software CAN bus implementation for rp2040 micro-controllers
GNU General Public License v3.0
686 stars 68 forks source link

Fix txpending race from report_line_ackdone() #31

Closed KevinOConnor closed 1 year ago

KevinOConnor commented 1 year ago

It is possible that a call to can2040_transmit() that occurs during an rx message, after an ack is generated, but before the 6th eof bit is received, could lead to report_line_txpending() incorrectly scheduling a duplicate ack. Depending on the timing of the can2040_transmit() it could result in a race condition in the PIO.

Further constrain the ack generation check in report_line_txpending() to avoid this race.