Page MenuHomeFreeBSD

sctp: Fix iterator synchronization in sctp_sendall()
ClosedPublic

Authored by markj on Sep 2 2021, 9:13 PM.
Tags
None
Referenced Files
F170733610: D31813.id.diff
Sun, Sep 6, 7:15 AM
F170729723: D31813.id94580.diff
Sun, Sep 6, 6:34 AM
Unknown Object (File)
Thu, Sep 3, 7:42 AM
Unknown Object (File)
Tue, Sep 1, 1:43 PM
Unknown Object (File)
Tue, Sep 1, 12:49 PM
Unknown Object (File)
Tue, Sep 1, 7:27 AM
Unknown Object (File)
Sat, Aug 29, 8:24 AM
Unknown Object (File)
Fri, Aug 28, 11:52 PM
Subscribers

Details

Summary
- The SCTP_PCB_FLAGS_SND_ITERATOR_UP check was racy, since two threads
  could observe that the flag is not set and then both set it.  I'm not
  sure if this is actually a problem in practice, i.e., maybe there's no
  problem having multiple sends for a single PCB in the iterator list?
- sctp_sendall() was modifying sctp_flags without the inp lock held.

The change simply acquires the PCB write lock before toggling the flag,
fixing both problems.

N.B., sctp_sendall() seems buggy for other reasons: it appears to handle
uio == NULL (taking the input mbuf instead) but unconditionally
dereferences uio.

Diff Detail

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