Commit 2b07e8f
committed
SPP: Add mutex protection in spp_command_uninit to prevent concurrent access
v/80850
Rootcause: uv_loop_close() marks internal data structures as invalid (e.g., set to -1), but pending callbacks in the queue still reference these invalidated structures. When uv_run() is called later, it processes the queue using corrupted pointers, leading to segmentation faults and crashes.
Solution:Introduce a global mutex 'spp_lock' to protect the entire cleanup process in
spp_command_uninit. The lock is initialized in spp_command_init and acquired
at the beginning of spp_command_uninit. It is released and destroyed at the
end of the function to ensure atomic execution of critical operations and
prevent data races.
Signed-off-by: v-chenghuijin <v-chenghuijin@xiaomi.com>1 parent 7bbb16b commit 2b07e8f
1 file changed
+14
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
87 | 91 | | |
88 | 92 | | |
89 | 93 | | |
| 94 | + | |
90 | 95 | | |
91 | 96 | | |
92 | 97 | | |
| |||
720 | 725 | | |
721 | 726 | | |
722 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
723 | 734 | | |
724 | 735 | | |
725 | 736 | | |
726 | 737 | | |
727 | 738 | | |
| 739 | + | |
728 | 740 | | |
729 | 741 | | |
730 | 742 | | |
731 | 743 | | |
| 744 | + | |
| 745 | + | |
732 | 746 | | |
733 | 747 | | |
734 | 748 | | |
| |||
0 commit comments