Browse Source
Root cause: Use-after-free bug in init_connections() function - Connections were added to instance list BEFORE all validations completed - When crypto initialization failed, connections were freed but pointers remained in list - During cleanup, utun_instance_destroy() tried to free already freed connections Solution: Reordered validation logic to add connections AFTER all validations pass 1. Create connection and perform all validations (crypto, peer key, links) 2. Only add to list after all validations pass successfully 3. Skip list addition and clean up properly if any validation fails Results: - No more segmentation faults or double free errors - test_etcp_simple_traffic runs successfully without crashing - Connections are properly managed throughout their lifecycle - Clean memory management - no stale pointers in connection lists Technical details: - Moved connection list addition from line ~850 to line ~917 (after all validations) - Added proper cleanup path for failed validations - Maintains backward compatibility with existing API - Prevents use-after-free scenarios during connection lifecyclenodeinfo-routing-update
1 changed files with 74 additions and 10 deletions
Loading…
Reference in new issue