Page MenuHomeFreeBSD

tcp: improve mbuf handling when processing SYN
ClosedPublic

Authored by tuexen on Sep 28 2024, 8:38 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Nov 10, 7:46 AM
Unknown Object (File)
Sun, Nov 3, 4:54 PM
Unknown Object (File)
Fri, Nov 1, 12:27 AM
Unknown Object (File)
Tue, Oct 29, 8:30 PM
Unknown Object (File)
Wed, Oct 23, 4:14 PM
Unknown Object (File)
Mon, Oct 21, 8:31 PM
Unknown Object (File)
Oct 18 2024, 2:43 AM
Unknown Object (File)
Oct 14 2024, 8:53 AM

Details

Summary

When the sysctl-variable net.inet.ip.accept_sourceroute is non-zero, an mbuf would be leaked when processing a SYN-segment containing an IPv4 strict or loose source routing option, when
the on-stack syncache entry is used or there is an error related to processing TCP MD5 options.

Fix this by freeing the mbuf whenever an error occurred or the on-stack syncache entry is used.

Diff Detail

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

Event Timeline

markj added inline comments.
sys/netinet/tcp_syncache.c
1585

Mostly unrelated, but this if-statement can be indented such that it applies only to the uma_zalloc() case. It's a minor thing but the control flow in this function is so complicated. :(

1777
This revision is now accepted and ready to land.Sep 30 2024, 10:34 AM
tuexen added inline comments.
sys/netinet/tcp_syncache.c
1585

I agree. Had the same observation, but did not want to intermix a the fix with a code cleanup with no functional change. Will do this as a follow-up.

1777

Will change it. But this is used multiple time this way in this file. Maybe this should be cleaned up first.