Re: [PATCH] rpmsg: virtio: don't let virtio core to validate used length

From: Michael S. Tsirkin
Date: Tue Nov 23 2021 - 01:16:05 EST


On Mon, Nov 22, 2021 at 05:08:12PM +0100, Arnaud Pouliquen wrote:
> For RX virtqueue, the used length is validated in all the three paths
> (big, small and mergeable). For control vq, we never tries to use used
> length. So this patch forbids the core to validate the used length.

Jason commented on this. This is copy paste from virtio net
where the change was merely an optimization.

> Without patch the rpmsg client sample does not work.

Hmm that's not enough of a description. Could you please
provide more detail? Does rpmsg device set used length to a
value > dma read buffer size? what kind of error message
do you get? what are the plans to fix the device?

> Fixes: 939779f5152d ("virtio_ring: validate used buffer length")
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@xxxxxxxxxxx>
> Cc: Jason Wang <jasowang@xxxxxxxxxx>
> Cc: Michael S. Tsirkin <mst@xxxxxxxxxx>
> ---
> base-commit: fa55b7dcdc43c1aa1ba12bca9d2dd4318c2a0dbf
> ---
> drivers/rpmsg/virtio_rpmsg_bus.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/rpmsg/virtio_rpmsg_bus.c b/drivers/rpmsg/virtio_rpmsg_bus.c
> index 9c112aa65040..5f73f19c2c38 100644
> --- a/drivers/rpmsg/virtio_rpmsg_bus.c
> +++ b/drivers/rpmsg/virtio_rpmsg_bus.c
> @@ -1054,6 +1054,7 @@ static struct virtio_driver virtio_ipc_driver = {
> .feature_table_size = ARRAY_SIZE(features),
> .driver.name = KBUILD_MODNAME,
> .driver.owner = THIS_MODULE,
> + .suppress_used_validation = true,
> .id_table = id_table,
> .probe = rpmsg_probe,
> .remove = rpmsg_remove,
> --
> 2.17.1