HomeFreeBSD

inpcb: Fix some bugs in _in_pcbinshash_wild()

Description

inpcb: Fix some bugs in _in_pcbinshash_wild()

  • In _in_pcbinshash_wild(), we should avoid returning v6 sockets unless no other matches are available. This preserves pre-existing semantics.
  • Fix an inverted test: when inserting a non-jailed PCB, we want to search for the first non-jailed PCB in the hash chain.
  • Test the right PCB when searching for a non-jailed PCB.

While here, add a required locking assertion.

Fixes: 7b92493ab1d4 ("inpcb: Avoid inp_cred dereferences in SMR-protected lookup")

Details

Provenance
markjAuthored on Apr 23 2023, 2:36 PM
Parents
rG66d6fd532282: sctp: use constants from RFC 8260 to improve compliance
Branches
Unknown
Tags
Unknown