]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sctp: Fix iterator synchronization in sctp_sendall()
authorMark Johnston <markj@FreeBSD.org>
Tue, 7 Sep 2021 13:44:57 +0000 (09:44 -0400)
committerMark Johnston <markj@FreeBSD.org>
Tue, 14 Sep 2021 12:51:54 +0000 (08:51 -0400)
commit97d24f3dfa7e9b8f4d59d29375ff600206aada12
treebbaea8aa18500cfe151799ad6b4de28fd44e3aab
parent086a3ea828dd101e9a07bb07fc698e009e68e3c3
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
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 173a7a4ee4fa8fbce6b4532d4d324bc72ee25fe0)
sys/netinet/sctp_output.c