net/rpmsg: sendsize should be protected by sendlock not recvlock

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-02-25 15:52:52 +08:00 committed by Xiang Xiao
parent 5b372a4706
commit 034215ab9c

View file

@ -334,7 +334,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
if (head->cmd == RPMSG_SOCKET_CMD_SYNC)
{
nxmutex_lock(&conn->recvlock);
nxmutex_lock(&conn->sendlock);
conn->sendsize = head->size;
conn->cred.pid = head->pid;
conn->cred.uid = head->uid;
@ -346,7 +346,7 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
rpmsg_socket_post(&conn->sendsem);
rpmsg_socket_poll_notify(conn, POLLOUT);
nxmutex_unlock(&conn->recvlock);
nxmutex_unlock(&conn->sendlock);
}
else if (head->cmd == RPMSG_SOCKET_CMD_DATA)
{
@ -764,10 +764,10 @@ static int rpmsg_socket_connect_internal(FAR struct socket *psock)
return ret;
}
nxmutex_lock(&conn->recvlock);
nxmutex_lock(&conn->sendlock);
if (conn->sendsize == 0)
{
nxmutex_unlock(&conn->recvlock);
nxmutex_unlock(&conn->sendlock);
if (_SS_ISNONBLOCK(conn->sconn.s_flags))
{
return -EINPROGRESS;
@ -788,7 +788,7 @@ static int rpmsg_socket_connect_internal(FAR struct socket *psock)
}
else
{
nxmutex_unlock(&conn->recvlock);
nxmutex_unlock(&conn->sendlock);
}
return ret;