drivers/misc: fix rpmsgdev read overflow

the msg count is not changed while iov len is increased.
which may cause the buffer reply by server is bigger than
msg count

Signed-off-by: rongyichang <rongyichang@xiaomi.com>
This commit is contained in:
rongyichang 2024-11-05 19:45:18 +08:00 committed by Xiang Xiao
parent 81e7b13a05
commit ee6e62c3ce

View file

@ -420,7 +420,7 @@ static ssize_t rpmsgdev_read(FAR struct file *filep, FAR char *buffer,
{
ret = rpmsgdev_send_recv(dev, command, true, &msg.header,
sizeof(msg) - 1, &read);
if (ret != -EAGAIN || priv->nonblock)
if (ret != -EAGAIN || read.iov_len > 0 || priv->nonblock)
{
break;
}