This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 18960c228c6db0ad6c50104ccb0af6c53d9c29e0 Author: yangjianqing <[email protected]> AuthorDate: Mon Mar 9 17:16:51 2026 +0800 net/tcp: fix use-after-free in tcp_accept_connection callback In tcp_accept_connection(), tcp_callback(dev, listener, TCP_BACKLOG) calls devif_conn_event() to traverse listener->sconn.s_list without holding listener->sconn.s_lock, only have netdev_lock. Meanwhile, tcp_pollteardown() on another CPU acquires only listener->sconn.s_lock (skipping netdev_lock since dev is NULL), Signed-off-by: yangjianqing <[email protected]> --- net/tcp/tcp_listen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/tcp/tcp_listen.c b/net/tcp/tcp_listen.c index db7342a98d0..122f66f7b32 100644 --- a/net/tcp/tcp_listen.c +++ b/net/tcp/tcp_listen.c @@ -276,6 +276,8 @@ int tcp_accept_connection(FAR struct net_driver_s *dev, { tcp_callback(dev, listener, TCP_BACKLOG); } + + conn_unlock(&listener->sconn); } #endif }
