Page MenuHomeFreeBSD

tcp: remove goto and address another NULL deref in SACK
ClosedPublic

Authored by rscheff on Jun 8 2022, 6:44 AM.
Tags
None
Referenced Files
F166319142: D35428.id106756.diff
Wed, Aug 12, 9:23 PM
F166316022: D35428.id.diff
Wed, Aug 12, 8:52 PM
Unknown Object (File)
Wed, Aug 12, 11:21 AM
Unknown Object (File)
Tue, Aug 11, 10:40 PM
Unknown Object (File)
Tue, Aug 11, 8:29 PM
Unknown Object (File)
Mon, Aug 10, 8:38 AM
Unknown Object (File)
Mon, Aug 10, 8:03 AM
Unknown Object (File)
Mon, Aug 10, 7:52 AM

Details

Summary

Missed another NULL dereference during KASSERTS after traversing
the scoreboard. While at it, scratch the goto by making the
traversal conditional.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45903
Build 42791: arc lint + arc unit

Event Timeline

hselasky added inline comments.
sys/netinet/tcp_sack.c
971–972

The NULL check should be inside the if (SEQ_GEQ()).

sys/netinet/tcp_sack.c
962

I would just write the code like this:

for (;;) {
hole = TAILQ_NEXT(hole, scblink);
if (hole == NULL)
return (hole);
if ....
   break;
}
962

To avoid duplicated NULL checks.

  • unconditional loop, with checks inside
This revision was not accepted when it landed; it landed in state Needs Review.Jun 8 2022, 7:39 AM
This revision was automatically updated to reflect the committed changes.