You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/05/03 19:42:58 UTC

[GitHub] [incubator-nuttx] antmerlino opened a new pull request #3655: Attempt to fix race condition reported in issue #3647

antmerlino opened a new pull request #3655:
URL: https://github.com/apache/incubator-nuttx/pull/3655


   ## Summary
   Attempt to fix race condition reported in issue #3647
   
   ## Impact
   
   ## Testing
   None.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #3655: Attempt to fix race condition reported in issue #3647

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #3655:
URL: https://github.com/apache/incubator-nuttx/pull/3655#discussion_r625802694



##########
File path: net/tcp/tcp_send_unbuffered.c
##########
@@ -584,7 +584,10 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
       goto errout;
     }
 
-  /* If this is an un-connected socket, then return ENOTCONN */
+  /* Check early if this is an un-connected socket, if so, then
+   * return -ENOTCONN. Note, we will have to check this again, as we can't
+   * guarantee the state won't change until we have the network locked.
+   */
 
   if (psock->s_type != SOCK_STREAM || !_SS_ISCONNECTED(psock->s_flags))

Review comment:
       should we remove _SS_ISCONNECTED from the check? it is useless without net_lock.

##########
File path: net/tcp/tcp_send_unbuffered.c
##########
@@ -639,6 +642,19 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
    */
 
   net_lock();
+
+  /* Now that we have the network locked, we need to check the connection
+   * state again to ensure the connection is still valid.
+   */
+
+  if (psock->s_type != SOCK_STREAM || !_SS_ISCONNECTED(psock->s_flags))

Review comment:
       remove psock->s_type != SOCK_STREAM from check?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #3655: Attempt to fix race condition reported in issue #3647

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #3655:
URL: https://github.com/apache/incubator-nuttx/pull/3655


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org