mirror of
https://github.com/apache/nuttx.git
synced 2026-05-10 15:30:25 +08:00
net/bluetooth: fix rmutex deadlock
the lock in the "bluetooth_conn" was not initialized, which resulted in a blocking situation when attempting to hold the lock for the first time. Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
@@ -166,6 +166,8 @@ void bluetooth_conn_free(FAR struct bluetooth_conn_s *conn)
|
||||
bluetooth_container_free(container);
|
||||
}
|
||||
|
||||
nxrmutex_destroy(&conn->bc_conn.s_lock);
|
||||
|
||||
/* Free the connection structure */
|
||||
|
||||
NET_BUFPOOL_FREE(g_bluetooth_connections, conn);
|
||||
|
||||
@@ -127,6 +127,7 @@ static int bluetooth_sockif_alloc(FAR struct socket *psock)
|
||||
|
||||
DEBUGASSERT(conn->bc_crefs == 0);
|
||||
conn->bc_crefs = 1;
|
||||
nxrmutex_init(&conn->bc_conn.s_lock);
|
||||
|
||||
/* Save the pre-allocated connection in the socket structure */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user