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/07/01 11:14:18 UTC

[GitHub] [incubator-nuttx] GUIDINGLI opened a new pull request #4014: net/tcp: fix tcp crash when net meet popen syscall

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


   
   
   ## Summary
   
   net/tcp: fix tcp crash when net meet popen syscall
   
   tcp_close_monitor should free all the connevents which
   belong to current psock
   
   ## Impact
   
   ## Testing
   
   


-- 
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



[GitHub] [incubator-nuttx] yamt commented on a change in pull request #4014: net/tcp: fix tcp crash when net meet popen syscall

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



##########
File path: net/tcp/tcp_monitor.c
##########
@@ -346,15 +346,13 @@ void tcp_close_monitor(FAR struct socket *psock)
   /* Find and free the the connection event callback */
 
   net_lock();
-  for (cb = conn->connevents;
-       cb != NULL && cb->priv != (FAR void *)psock;
-       cb = cb->nxtconn)
-    {
-    }
 
-  if (cb != NULL)
+  for (cb = conn->connevents; cb != NULL; cb = cb->nxtconn)
     {
-      devif_conn_callback_free(conn->dev, cb, &conn->connevents);
+      if (cb->priv == (FAR void *)psock)
+        {
+          devif_conn_callback_free(conn->dev, cb, &conn->connevents);

Review comment:
       doesn't this put the "cb" onto the freelist, using cb->nxtconn, and thus break the iteration?




-- 
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



[GitHub] [incubator-nuttx] yamt commented on a change in pull request #4014: net/tcp: fix tcp crash when net meet popen syscall

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



##########
File path: net/tcp/tcp_monitor.c
##########
@@ -346,15 +346,13 @@ void tcp_close_monitor(FAR struct socket *psock)
   /* Find and free the the connection event callback */
 
   net_lock();
-  for (cb = conn->connevents;
-       cb != NULL && cb->priv != (FAR void *)psock;
-       cb = cb->nxtconn)
-    {
-    }
 
-  if (cb != NULL)
+  for (cb = conn->connevents; cb != NULL; cb = cb->nxtconn)
     {
-      devif_conn_callback_free(conn->dev, cb, &conn->connevents);
+      if (cb->priv == (FAR void *)psock)
+        {
+          devif_conn_callback_free(conn->dev, cb, &conn->connevents);

Review comment:
       i read the summary as of today but it doesn't seem answering my concern about list corruption.




-- 
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



[GitHub] [incubator-nuttx] GUIDINGLI closed pull request #4014: net/tcp: fix tcp crash when net meet popen syscall

Posted by GitBox <gi...@apache.org>.
GUIDINGLI closed pull request #4014:
URL: https://github.com/apache/incubator-nuttx/pull/4014


   


-- 
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



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #4014: net/tcp: fix tcp crash when net meet popen syscall

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



##########
File path: net/tcp/tcp_monitor.c
##########
@@ -346,15 +346,13 @@ void tcp_close_monitor(FAR struct socket *psock)
   /* Find and free the the connection event callback */
 
   net_lock();
-  for (cb = conn->connevents;
-       cb != NULL && cb->priv != (FAR void *)psock;
-       cb = cb->nxtconn)
-    {
-    }
 
-  if (cb != NULL)
+  for (cb = conn->connevents; cb != NULL; cb = cb->nxtconn)
     {
-      devif_conn_callback_free(conn->dev, cb, &conn->connevents);
+      if (cb->priv == (FAR void *)psock)
+        {
+          devif_conn_callback_free(conn->dev, cb, &conn->connevents);

Review comment:
       see the Summary




-- 
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



[GitHub] [incubator-nuttx] GUIDINGLI commented on a change in pull request #4014: net/tcp: fix tcp crash when net meet popen syscall

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



##########
File path: net/tcp/tcp_monitor.c
##########
@@ -346,15 +346,13 @@ void tcp_close_monitor(FAR struct socket *psock)
   /* Find and free the the connection event callback */
 
   net_lock();
-  for (cb = conn->connevents;
-       cb != NULL && cb->priv != (FAR void *)psock;
-       cb = cb->nxtconn)
-    {
-    }
 
-  if (cb != NULL)
+  for (cb = conn->connevents; cb != NULL; cb = cb->nxtconn)
     {
-      devif_conn_callback_free(conn->dev, cb, &conn->connevents);
+      if (cb->priv == (FAR void *)psock)
+        {
+          devif_conn_callback_free(conn->dev, cb, &conn->connevents);

Review comment:
       Yes, you are right, this fix doesn't works.
   I will abandon this RP until find the root case.




-- 
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