net/tcp: Search conn list again to aovid the race condition in tcp_timer_expiry

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-06-05 23:43:17 +08:00 committed by Petro Karashchenko
parent fe85e9d0fa
commit 9d4c708913
1 changed files with 12 additions and 3 deletions

View File

@ -138,11 +138,20 @@ static int tcp_get_timeout(FAR struct tcp_conn_s *conn)
static void tcp_timer_expiry(FAR void *arg)
{
FAR struct tcp_conn_s *conn = arg;
FAR struct tcp_conn_s *conn = NULL;
net_lock();
conn->timeout = true;
netdev_txnotify_dev(conn->dev);
while ((conn = tcp_nextconn(conn)) != NULL)
{
if (conn == arg)
{
conn->timeout = true;
netdev_txnotify_dev(conn->dev);
break;
}
}
net_unlock();
}