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 c58e511f372e7ee5e398d71833c254f3f0adf675 Author: wangshaoxin <[email protected]> AuthorDate: Thu Mar 5 15:17:36 2026 +0800 nuttx/net: init/uninit s_lock when alloc/free socket_conn_s struct rpmsg_socket_alloc()/rpmsg_socket_free() and vsock_alloc()/vsock_free() did not initialise or destroy socket_conn_s::s_lock, leaving the mutex uninitialised for rpmsg and vsock sockets. Include utils/utils.h and call conn_init()/conn_uninit() so the lock is set up on allocation and released on free Signed-off-by: wangshaoxin <[email protected]> --- net/rpmsg/rpmsg_sockif.c | 3 +++ net/vsock/vsock_sockif.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/net/rpmsg/rpmsg_sockif.c b/net/rpmsg/rpmsg_sockif.c index 58108266f7f..d6a8c283a9c 100644 --- a/net/rpmsg/rpmsg_sockif.c +++ b/net/rpmsg/rpmsg_sockif.c @@ -49,6 +49,7 @@ #include <netpacket/rpmsg.h> #include "socket/socket.h" +#include "utils/utils.h" /**************************************************************************** * Pre-processor Definitions @@ -288,6 +289,7 @@ static FAR struct rpmsg_socket_conn_s *rpmsg_socket_alloc(void) return NULL; } + conn_init(&conn->sconn); nxmutex_init(&conn->polllock); nxmutex_init(&conn->sendlock); nxmutex_init(&conn->recvlock); @@ -309,6 +311,7 @@ static void rpmsg_socket_free(FAR struct rpmsg_socket_conn_s *conn) nxmutex_destroy(&conn->sendlock); nxsem_destroy(&conn->sendsem); nxsem_destroy(&conn->recvsem); + conn_uninit(&conn->sconn); kmm_free(conn); } diff --git a/net/vsock/vsock_sockif.c b/net/vsock/vsock_sockif.c index 4fb690e3471..bf60bd5c24a 100644 --- a/net/vsock/vsock_sockif.c +++ b/net/vsock/vsock_sockif.c @@ -39,6 +39,7 @@ #include <nuttx/spinlock.h> #include "socket/socket.h" +#include "utils/utils.h" #include "vsock/vsock.h" #include "vsock/vsock_virtio.h" @@ -478,6 +479,7 @@ static void vsock_free(FAR struct vsock_conn_s *conn) vsockdbg("vsock free, conn=%p\n", conn); nxrmutex_destroy(&conn->rx_lock); nxrmutex_destroy(&conn->tx_lock); + conn_uninit(&conn->sconn); nxsem_destroy(&conn->rx_sem); nxsem_destroy(&conn->tx_sem); circbuf_uninit(&conn->rx_buf); @@ -549,6 +551,7 @@ static FAR struct vsock_conn_s *vsock_alloc(void) nxrmutex_init(&conn->rx_lock); nxrmutex_init(&conn->tx_lock); + conn_init(&conn->sconn); spin_lock_init(&conn->poll_lock); spin_lock_init(&conn->cnt_lock); nxsem_init(&conn->rx_sem, 0, 0);
