Page MenuHomeFreeBSD

sctp: Fix iterator synchronization in sctp_sendall()
ClosedPublic

Authored by markj on Sep 2 2021, 9:13 PM.
Tags
None
Referenced Files
F102924274: D31813.diff
Mon, Nov 18, 7:35 PM
Unknown Object (File)
Mon, Nov 11, 12:17 PM
Unknown Object (File)
Mon, Oct 28, 2:41 AM
Unknown Object (File)
Oct 14 2024, 9:51 PM
Unknown Object (File)
Oct 9 2024, 3:23 PM
Unknown Object (File)
Sep 24 2024, 3:31 PM
Unknown Object (File)
Sep 23 2024, 5:17 PM
Unknown Object (File)
Sep 16 2024, 9:05 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 41340
Build 38229: arc lint + arc unit