rpmsg_scoket: handle race condition on ept_cb RPMSG_SOCKET_CMD_SYNC

Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd 2021-12-03 20:38:34 +08:00 committed by Xiang Xiao
parent d0486be2a3
commit be70ab2ebb
1 changed files with 2 additions and 0 deletions

View File

@ -296,9 +296,11 @@ static int rpmsg_socket_ept_cb(FAR struct rpmsg_endpoint *ept,
if (head->cmd == RPMSG_SOCKET_CMD_SYNC)
{
rpmsg_socket_lock(&conn->recvlock);
conn->sendsize = head->size;
conn->psock->s_flags |= _SF_CONNECTED;
_SO_SETERRNO(conn->psock, OK);
rpmsg_socket_unlock(&conn->recvlock);
rpmsg_socket_post(&conn->sendsem);
rpmsg_socket_pollnotify(conn, POLLOUT);
}