usrsock_rpmsg_server: Clear revents for POLLHUP and POLLERR

Note:
tcp_poll_eventhandler have logic after poll_notify, if we teardown poll
inside poll callback without clearing revents, use-after-free will
happen.

Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
Zhe Weng 2023-07-06 16:32:53 +08:00 committed by Xiang Xiao
parent bd52ae1ad9
commit 33da959fbc

View file

@ -1082,6 +1082,7 @@ static void usrsock_rpmsg_poll_setup(FAR struct pollfd *pfds,
}
else
{
pfds->revents = 0;
pfds->events = 0;
ret = psock_poll(psock, pfds, false);
}
@ -1142,6 +1143,10 @@ static void usrsock_rpmsg_poll_cb(FAR struct pollfd *pfds)
{
events |= USRSOCK_EVENT_RECVFROM_AVAIL;
}
/* Clear revents */
pfds->revents &= ~(POLLHUP | POLLERR);
}
if (oldevents != pfds->events)