1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-24 11:29:10 +00:00

Add a comment to tcp_usr_accept() to indicate why it is we acquire the

tcbinfo lock there: r175612, which re-added it, masked a race between
sonewconn(2) and accept(2) that could allow an incompletely initialized
address on a newly-created socket on a listen queue to be exposed.  Full
details can be found in that commit message.

MFC after:	1 week
Sponsored by:	Juniper Networks
This commit is contained in:
Robert Watson 2010-03-06 21:38:31 +00:00
parent 1bb635b04d
commit 8296cddfdd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=204809

View File

@ -560,9 +560,15 @@ tcp_usr_disconnect(struct socket *so)
}
/*
* Accept a connection. Essentially all the work is
* done at higher levels; just return the address
* of the peer, storing through addr.
* Accept a connection. Essentially all the work is done at higher levels;
* just return the address of the peer, storing through addr.
*
* The rationale for acquiring the tcbinfo lock here is somewhat complicated,
* and is described in detail in the commit log entry for r175612. Acquiring
* it delays an accept(2) racing with sonewconn(), which inserts the socket
* before the inpcb address/port fields are initialized. A better fix would
* prevent the socket from being placed in the listen queue until all fields
* are fully initialized.
*/
static int
tcp_usr_accept(struct socket *so, struct sockaddr **nam)