All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virgl: fix caps ioctl size check.
@ 2018-02-13  0:26 Dave Airlie
  2018-02-13  0:28 ` Stéphane Marchesin
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Airlie @ 2018-02-13  0:26 UTC (permalink / raw)
  To: dri-devel

From: Dave Airlie <airlied@redhat.com>

The size check seems backwards, if userspace gives us a size
larger it is probably asking for a newer version of the caps,
so we just fill in the caps version we have at the smaller
size, and it can work it out from there.

Userspace will probably still need a fallback as old
kernel are out there.

Cc: <stable@vger.kernel.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 5720a0d4ac0a..5d5f79508100 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -497,7 +497,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
 	}
 
 	size = vgdev->capsets[found_valid].max_size;
-	if (args->size > size) {
+	if (size > args->size) {
 		spin_unlock(&vgdev->display_info_lock);
 		return -EINVAL;
 	}
-- 
2.14.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] virgl: fix caps ioctl size check.
  2018-02-13  0:26 [PATCH] virgl: fix caps ioctl size check Dave Airlie
@ 2018-02-13  0:28 ` Stéphane Marchesin
  0 siblings, 0 replies; 2+ messages in thread
From: Stéphane Marchesin @ 2018-02-13  0:28 UTC (permalink / raw)
  To: Dave Airlie; +Cc: dri-devel

On Mon, Feb 12, 2018 at 4:26 PM, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> The size check seems backwards, if userspace gives us a size
> larger it is probably asking for a newer version of the caps,
> so we just fill in the caps version we have at the smaller
> size, and it can work it out from there.
>
> Userspace will probably still need a fallback as old
> kernel are out there.
>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Dave Airlie <airlied@redhat.com>

Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>

Thanks!

> ---
>  drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 5720a0d4ac0a..5d5f79508100 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -497,7 +497,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
>         }
>
>         size = vgdev->capsets[found_valid].max_size;
> -       if (args->size > size) {
> +       if (size > args->size) {
>                 spin_unlock(&vgdev->display_info_lock);
>                 return -EINVAL;
>         }
> --
> 2.14.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-13  0:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-13  0:26 [PATCH] virgl: fix caps ioctl size check Dave Airlie
2018-02-13  0:28 ` Stéphane Marchesin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.