mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user