HomeFreeBSD

Fix locking in soisconnected().

Description

Fix locking in soisconnected().

When a newborn socket moves from incomplete queue to complete
one, we need to obtain the listening socket lock after the child,
which is a wrong order. The old code did that in potentially
endless loop of mtx_trylock(). The new one does only one attempt
of mtx_trylock(), and in case of failure references listening
socket, unlocks child and locks everything in right order. In
case if listening socket shuts down during that, just bail out.

Reported & tested by: Jason Eggleston <jeggleston llnw.com>
Reported & tested by: Jason Wolfe <jason llnw.com>

Details

Provenance
glebiusAuthored on
Parents
rS323593: Add support for handling undefined instructions in userspace and the
Branches
Unknown
Tags
Unknown