Skip to content

l2tp: Fix race conditions at tunnel creation time.

Guillaume Nault requested to merge gnault/centos-stream-9:bz2162322 into main

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2162322 Upstream Status: net.git

Store L2TP tunnels in an IDR rather than a linked list (patch 1).

Then use this IDR to reserve the tunnel ID at the beginning of the registration process, so that we can store the new tunnel at the very end of it and be guaranteed this operation won't fail (patch 2).

Storing the tunnel in the IDR at the end of the process is necessary in order to not expose partially initialised tunnels. However the socket modifications done at registration time can't be properly undone, so they used to be done at the end of the process. IDR reservation allows cope with both requirements.

Finally, patch 3 fixes a lock ordering issue introduced in patch 2.

Signed-off-by: Guillaume Nault gnault@redhat.com

Merge request reports