Commit 5fe82aa
authored
[Sponsored by CubePilot] Try to fix potential mavlink segfaults on USB disconnect (#26083)
* mavlink: fix potential use-after-free
If a mavlink instance is force stopped, the main thread might be out of
scope and the receiver thread would be doing a use-after-free.
Instead the receiver thread needs to check its own _should_exit flag.
* mavlink: protect shared data by mutex in dtor
I'm not sure if this potentially fixes any of the segfaults we have seen
on stopping mavlink instances but it potentially could matter if the
mavlink_receiver thread is killed after a timeout and tries to send any
messages as a zombie.1 parent b92d21b commit 5fe82aa
2 files changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3160 | 3160 | | |
3161 | 3161 | | |
3162 | 3162 | | |
3163 | | - | |
| 3163 | + | |
3164 | 3164 | | |
3165 | 3165 | | |
3166 | 3166 | | |
| |||
0 commit comments