rpmsg_socket: rpmsg_send_nocpy() should lock with rpmsg_destroy_ept

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2023-01-06 22:24:42 +08:00 committed by Xiang Xiao
parent c0735f06f6
commit d6cad21a17
1 changed files with 4 additions and 2 deletions

View File

@ -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);