This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 364cca18a73063d575f0a7d7dde5edf50b64c448
Author: wangchen <[email protected]>
AuthorDate: Wed Feb 25 16:31:49 2026 +0800

    net/netlink: initialize socket connection in netlink_alloc
    
    netlink_alloc() returned a connection whose socket_conn_s had never been
    initialised, so s_lock was left as zeroed memory and the first lock
    operation ran on an uninitialised rmutex.  Call conn_init() on the new
    connection so the lock is a valid rmutex before it is used.
    
    Signed-off-by: wangchen <[email protected]>
---
 net/netlink/netlink_conn.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/netlink/netlink_conn.c b/net/netlink/netlink_conn.c
index bd1e8401c3e..7599df1c71e 100644
--- a/net/netlink/netlink_conn.c
+++ b/net/netlink/netlink_conn.c
@@ -162,6 +162,10 @@ FAR struct netlink_conn_s *netlink_alloc(void)
   conn = NET_BUFPOOL_TRYALLOC(g_netlink_connections);
   if (conn != NULL)
     {
+      /* Use conn_init to initialize the connection structure */
+
+      conn_init(&conn->sconn);
+
       /* Enqueue the connection into the active list */
 
       dq_addlast(&conn->sconn.s_node, &g_active_netlink_connections);

Reply via email to