]> git.baikalelectronics.ru Git - kernel.git/commit
drm/virtio: fix bounds check in virtio_gpu_cmd_get_capset()
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 4 Jul 2018 09:42:50 +0000 (12:42 +0300)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 30 Aug 2018 07:41:03 +0000 (09:41 +0200)
commit20e3a53e51c7e98af2cf5fb1725b4467aab7d4d9
tree5141c28051d7c90204ddaf1e7729cf70f2c8e0d2
parent55536fa5f3aefde176a6c36cd3f7ef56ee810277
drm/virtio: fix bounds check in virtio_gpu_cmd_get_capset()

This doesn't affect runtime because in the current code "idx" is always
valid.

First, we read from "vgdev->capsets[idx].max_size" before checking
whether "idx" is within bounds.  And secondly the bounds check is off by
one so we could end up reading one element beyond the end of the
vgdev->capsets[] array.

Fixes: 02e398c17c39 ("virtio-gpu: add 3d/virgl support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20180704094250.m7sgvvzg3dhcvv3h@kili.mountain
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_vq.c