HomeFreeBSD

Fix a degenerate case when soisdisconnected() would call soisconnected().

Description

Fix a degenerate case when soisdisconnected() would call soisconnected().

This happens when closing a socket with upcall, and trace is: soclose()->
... protocol ... -> soisdisconnected() -> socantrcvmore_locked() ->
sowakeup() -> soisconnected().

Right now this case is innocent for two reasons. First, soisconnected()
doesn't clear SS_ISDISCONNECTED flag. Second, the mutex to lock the
socket is the socket receive buffer mutex, and sodisconnected() first
disables the receive buffer. But in future code, the mutex to lock
socket is different to buffer mutex, and we would get undesired mutex
recursion.

The fix is to check SS_ISDISCONNECTED flag before calling upcall.

Details

Provenance
glebiusAuthored on
Parents
rS319684: Make the test to leave one connection on the incomplete queue
Branches
Unknown
Tags
Unknown