Page MenuHomeFreeBSD

tcp: fix TCPS_CLOSED state underleak in syncache_socket()
AcceptedPublic

Authored by glebius on Wed, Sep 2, 9:24 PM.
Tags
None
Referenced Files
F170693924: D59325.id185652.diff
Sun, Sep 6, 1:45 AM
F170688810: D59325.id185652.diff
Sun, Sep 6, 1:09 AM
F170684482: D59325.diff
Sun, Sep 6, 12:38 AM
F170613637: D59325.id185652.diff
Sat, Sep 5, 3:44 PM
F170581069: D59325.id185652.diff
Sat, Sep 5, 12:23 PM
Unknown Object (File)
Sat, Sep 5, 8:08 AM
Unknown Object (File)
Sat, Sep 5, 5:19 AM
Unknown Object (File)
Sat, Sep 5, 4:43 AM
Subscribers

Details

Reviewers
tuexen
jtl
Group Reviewers
transport
Summary

The syncache entry holds one TCPS_SYN_RECEIVED count that normally is
transferred to the the newborn tp. Upon failure syncache_socket() shall
not use TCPSTATES_INC/TCPSTATES_DEC (see 5050df3f4aa4 why). But when
syncache_socket() fails in_pcbconnect(), it calls tcp_discardcb() to free
resources that were just allocated by tcp_newtcpcb() and this
tcp_discardcb() would do TCPSTATES_DEC(tp->t_state). The t_state is
TCPS_CLOSED at this point.

Make tcp_discardcb() symmetrical to tcp_newtcpcb() - not responsible for
the TCPSTATES. Make the caller responsible for state count book keeping.

Fixes: 3703e1a73e0e0367c04f47f793e46495e46e647b
MFC After: 2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 76414
Build 73297: arc lint + arc unit