Fix race condition in px4io serial driver (#20005)

* px4io: prevent memory corruption on corrput io data

* px4io_serial: Prevent race between handling wait timeout case and interrupt posting semaphore
This commit is contained in:
Thomas Debrunner
2022-08-18 17:46:47 +02:00
committed by GitHub
parent 02c4e0361c
commit 44a18acd51
4 changed files with 124 additions and 96 deletions
+1 -1
View File
@@ -1216,7 +1216,7 @@ int PX4IO::io_get_status()
uint16_t raw_inputs = io_reg_get(PX4IO_PAGE_RAW_RC_INPUT, PX4IO_P_RAW_RC_COUNT);
for (unsigned i = 0; i < raw_inputs; i++) {
for (unsigned i = 0; (i < raw_inputs) && (i < _max_rc_input); i++) {
status.raw_inputs[i] = io_reg_get(PX4IO_PAGE_RAW_RC_INPUT, PX4IO_P_RAW_RC_BASE + i);
}