Skip to contentSkip to conversation

virgl: fix caps ioctl size check.

PATCH In review Dave Airlie 2 participants 2 messages Feb 13, 2018

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 virgl: fix caps ioctl size check.

From: Dave Airlie <[email protected]>

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.

---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +1 -1
index 5720a0d4ac0a..5d5f79508100 100644
@@ -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;
 	}
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dave Airlie

From: Dave Airlie <[email protected]>

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.

Quoted 5 lines

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

Thanks!

Quoted 20 lines
---
 drivers/gpu/drm/virtio/virtgpu_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/virtio/virtgpu_ioctl.c +1 -2
index 5720a0d4ac0a..5d5f79508100 100644
@@ -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

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel