HomeFreeBSD

sctp: Fix iterator synchronization in sctp_sendall()

Description

sctp: Fix iterator synchronization in sctp_sendall()

  • 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.

Reviewed by: tuexen
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31813

Details

Provenance
markjAuthored on Sep 7 2021, 1:44 PM
Reviewer
tuexen
Differential Revision
D31813: sctp: Fix iterator synchronization in sctp_sendall()
Parents
rGe8e23ec127d4: sctp: Remove an unused sctp_inpcb field
Branches
Unknown
Tags
Unknown