From ab92b7d04d18f22a327ae0f1519fa28d91d96edd Mon Sep 17 00:00:00 2001 From: wangchen Date: Mon, 18 Mar 2024 15:35:25 +0800 Subject: [PATCH] tcp_close.c:when tcp socket stays in TCP_FIN_WAIT_1 or TCP_FIN_WAIT_2,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 --- net/tcp/tcp_input.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index d56dfcb9bc..3b1bedd634 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -1629,6 +1629,12 @@ found: */ 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; } @@ -1662,6 +1668,12 @@ found: */ 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; }