drivers/misc: fix rpmsg dev poll assert crash

when client read and poll wait buffer from server side and server side may
poll notify more than one times, then rpmsgdev in client side will call
"rpmsgdev_poll_setup(priv, 0, false);" twice which will cause crash in
vela rpmsgdev_server.c

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
This commit is contained in:
rongyichang 2024-11-05 17:26:37 +08:00 committed by Xiang Xiao
parent 0bad7f814a
commit d73815e3e9

View file

@ -403,12 +403,13 @@ static int rpmsgdev_poll_handler(FAR struct rpmsg_endpoint *ept,
}
else
{
DEBUGASSERT(dev->cfd != 0);
msg->header.result = file_poll(&dev->file, &dev->fd, false);
if (msg->header.result == OK)
if (dev->cfd != 0)
{
dev->cfd = 0;
msg->header.result = file_poll(&dev->file, &dev->fd, false);
if (msg->header.result == OK)
{
dev->cfd = 0;
}
}
}