Networking: Fix a race condition. The accept() operation is performed with the network locked. However, the network is unlocked BEFORE the connected state is set. Therefore, a context switch may occur and the socket may no longer be connected when it is marked so. Noted by Pascal Speck.

This commit is contained in:
Gregory Nutt
2017-08-31 07:23:19 -06:00
parent 9d3b1af1cd
commit 7ebef900fb
8 changed files with 28 additions and 13 deletions
+3
View File
@@ -308,6 +308,9 @@ static int pkt_connect(FAR struct socket *psock,
* Returns 0 (OK) on success. On failure, it returns a negated errno
* value. See accept() for a desrciption of the approriate error value.
*
* Assumptions:
* The network is locked.
*
****************************************************************************/
static int pkt_accept(FAR struct socket *psock, FAR struct sockaddr *addr,