On Tue, Apr 28, 2026 at 09:44:49PM +0200, Sergio Lopez wrote:
> If VIRTIO_GPU_F_BLOB_ALIGNMENT has been negotiated, blob size must be
> aligned to blob_alignment. Validate this in verify_blob() so that
> invalid requests are rejected early.
>
> Signed-off-by: Sergio Lopez <[email protected]>

FYI: this change breaks crosvm, which is squatting the 5 and 6 values
of VIRTIO_GPU_F_* with different meanings.  I've reported it as a
crosvm bug, so hopefully it can be taken care of there.

https://issuetracker.google.com/issues/529852979

> ---
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c 
> b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index c33c057365f8..d0c4edf1eaf4 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -489,6 +489,11 @@ static int verify_blob(struct virtio_gpu_device *vgdev,
>       params->size = rc_blob->size;
>       params->blob = true;
>       params->blob_flags = rc_blob->blob_flags;
> +
> +     if (vgdev->has_blob_alignment &&
> +         !IS_ALIGNED(params->size, vgdev->blob_alignment))
> +             return -EINVAL;
> +
>       return 0;
>  }
>
> --
> 2.53.0
>

Attachment: signature.asc
Description: PGP signature

Reply via email to