HomeFreeBSD

sctp: Fix racy UNBOUND flag check in sctp_inpcb_bind()

Description

sctp: Fix racy UNBOUND flag check in sctp_inpcb_bind()

SCTP needs to avoid binding a given socket twice. The check used to
avoid this is racy since neither the inpcb lock nor the global info lock
is held. Fix it by synchronizing using the global info lock. In
particular, sctp_inpcb_bind() may drop the inpcb lock in some cases, but
the info lock is sufficient to prevent double insertion into PCB hash
tables.

Reported by: syzbot+548a8560d959669d0e12@syzkaller.appspotmail.com
Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4a36122b1db1b255cf21d926b997d524e6782429)

Details

Provenance
markjAuthored on Aug 31 2021, 11:43 AM
Parents
rG996a40d6ad5e: itimer: Serialize access to the p_itimers array
Branches
Unknown
Tags
Unknown