Skip to content

Commit

Permalink
tcp_close.c:when tcp socket stays in TCP_FIN_WAIT_1 or TCP_FIN_WAIT_2…
Browse files Browse the repository at this point in the history
…,calling tcp_close_eventhandler releases received packets

when tcp socket stays in TCP_FIN_WAIT_1 or TCP_FIN_WAIT_2,not actively calling tcp_close_eventhandler,can reuslt in some TCP socket being set to a closed state,but nofosegs are not directly released,leading to IOB resource leakage.

Signed-off-by: wangchen <[email protected]>
  • Loading branch information
wangchen61698 committed Aug 26, 2024
1 parent 4d4d8a6 commit 4ff01ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions net/tcp/tcp_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -1616,6 +1616,12 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
*/

conn->tcpstateflags = TCP_CLOSED;

/* In the TCP_FIN_WAIT_1, we need call tcp_close_eventhandler to
* release nofosegs, that we received in this state.
*/

tcp_callback(dev, conn, TCP_CLOSE);
tcp_reset(dev, conn);
return;
}
Expand Down Expand Up @@ -1649,6 +1655,12 @@ static void tcp_input(FAR struct net_driver_s *dev, uint8_t domain,
*/

conn->tcpstateflags = TCP_CLOSED;

/* In the TCP_FIN_WAIT_2, we need call tcp_close_eventhandler to
* release nofosegs, that we received in this state.
*/

tcp_callback(dev, conn, TCP_CLOSE);
tcp_reset(dev, conn);
return;
}
Expand Down

0 comments on commit 4ff01ba

Please sign in to comment.