Page MenuHomeFreeBSD

tcp: fix counter leak for SYN_RCVD state when syncache_socket() fails
ClosedPublic

Authored by glebius on Dec 5 2022, 10:23 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 28 2023, 3:12 AM
Unknown Object (File)
Dec 23 2023, 12:05 AM
Unknown Object (File)
Dec 10 2023, 9:38 PM
Unknown Object (File)
Sep 26 2023, 6:12 PM
Unknown Object (File)
Aug 14 2023, 4:32 PM
Unknown Object (File)
Aug 14 2023, 3:19 AM
Unknown Object (File)
Jun 11 2023, 1:23 PM
Unknown Object (File)
May 29 2023, 3:17 PM
Subscribers

Details

Summary

The SYN_RCVD state count is tricky here due to default code path and TFO
being so different. In the default case the count is incremented when a
syncache entry is added to the the database in syncache_insert(). Later
when connection transitions from syncache entry to a socket in
syncache_expand(), this counter is inherited by the tcpcb. If socket or
tcpcb allocation failed in syncache_socket() failed the syncache_expand()
is responsible for decrement. In the TFO case the syncache entry is not
inserted into database and count of SYN_RCVD is first incremented in the
syncache_tfo_expand() after successful socket allocation. Thus, inside
syncache_socket() we can't tell whether we need to decrement in a case of
a failure or not. The caller is responsible for this book keeping.

Fixes: 07285bb4c22c026a50f69149d5dae03169b15fe4

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.Dec 14 2022, 3:32 AM
This revision was automatically updated to reflect the committed changes.