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 8b7c5f98ff57ca896c9f5f8573debe3e8df745e7 Author: Marco Casaroli <[email protected]> AuthorDate: Sun Nov 8 09:44:34 2026 +0100 net/pkt: Free the read-ahead queues in pkt_free(). pkt_close() freed the read-ahead and error-ahead queues before the connection left the active list. The input path can still queue frames on the connection after that point: - With CONFIG_NET_PKT_WRITE_BUFFERS, pkt_close() waits for the write queue to drain with the device unlocked. A frame that comes in during this wait is queued, for example a sent frame that comes back on lo. - A frame can also come in between conn_dev_unlock() and pkt_free(). pkt_free() then released the connection with these IOBs still queued, and nothing freed them. Free the queues in pkt_free() after dq_rem(), with the connection list locked, as can_conn_uninit(), icmp_free() and udp_free() do. pkt_in_() queues frames with the same lock held, so no frame can come in after this point. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- net/pkt/pkt_conn.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/pkt/pkt_conn.c b/net/pkt/pkt_conn.c index e1bda1c23f6..16bd18ecf58 100644 --- a/net/pkt/pkt_conn.c +++ b/net/pkt/pkt_conn.c @@ -143,6 +143,16 @@ void pkt_free(FAR struct pkt_conn_s *conn) iob_free_queue(&conn->readahead); +#ifdef CONFIG_NET_TIMESTAMP + iob_free_queue(&conn->errahead); +#endif + + /* Free the read-ahead data. pkt_in_() queues frames with the list + * locked, so no new frame can come in after dq_rem(). + */ + + iob_free_queue(&conn->readahead); + #ifdef CONFIG_NET_TIMESTAMP iob_free_queue(&conn->errahead); #endif
