Skip to content

Commit

Permalink
drivers/misc: fix rpmsg dev poll assert crash
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
terry0012 authored and xiaoxiang781216 committed Nov 12, 2024
1 parent 0bad7f8 commit d73815e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/misc/rpmsgdev_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down

0 comments on commit d73815e

Please sign in to comment.