rpmsg_socket: rpmsg_send_nocpy() should lock with rpmsg_destroy_ept
@@ -375,6 +375,7 @@ static inline void rpmsg_socket_destroy_ept(
}
nxmutex_lock(&conn->recvlock);
+ nxmutex_lock(&conn->sendlock);
if (conn->ept.rdev)
{
@@ -391,6 +392,7 @@ static inline void rpmsg_socket_destroy_ept(
rpmsg_socket_poll_notify(conn, POLLIN | POLLOUT);
}
+ nxmutex_unlock(&conn->sendlock);
nxmutex_unlock(&conn->recvlock);
}
@@ -1004,10 +1006,10 @@ static ssize_t rpmsg_socket_send_continuous(FAR struct socket *psock,
conn->lastpos = conn->recvpos;
conn->sendpos += msg->len;
- nxmutex_unlock(&conn->sendlock);
ret = rpmsg_sendto_nocopy(&conn->ept, msg, block + sizeof(*msg),
conn->ept.dest_addr);
+ nxmutex_unlock(&conn->sendlock);
if (ret < 0)
{
rpmsg_release_tx_buffer(&conn->ept, msg);
@@ -1107,9 +1109,9 @@ static ssize_t rpmsg_socket_send_single(FAR struct socket *psock,
conn->lastpos = conn->recvpos;
conn->sendpos += len + sizeof(uint32_t);
- nxmutex_unlock(&conn->sendlock);
ret = rpmsg_sendto_nocopy(&conn->ept, msg, total, conn->ept.dest_addr);
+ nxmutex_unlock(&conn->sendlock);
if (ret < 0)
{
rpmsg_release_tx_buffer(&conn->ept, msg);
