Skip to content

Commit 4db34ed

Browse files
committed
virtio-gpu: fix a missing check to avoid NULL dereference
jira VULN-69525 cve CVE-2022-50181 commit-author Xiaomeng Tong <[email protected]> commit bd63f11 'cache_ent' could be set NULL inside virtio_gpu_cmd_get_capset() and it will lead to a NULL dereference by a lately use of it (i.e., ptr = cache_ent->caps_cache). Fix it with a NULL check. Fixes: 62fb7a5 ("virtio-gpu: add 3d/virgl support") Signed-off-by: Xiaomeng Tong <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] [ kraxel: minor codestyle fixup ] Signed-off-by: Gerd Hoffmann <[email protected]> (cherry picked from commit bd63f11) Signed-off-by: Jonathan Maple <[email protected]>
1 parent 0f84f4f commit 4db34ed

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/gpu/drm/virtio/virtgpu_ioctl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
579579
spin_unlock(&vgdev->display_info_lock);
580580

581581
/* not in cache - need to talk to hw */
582-
virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
583-
&cache_ent);
582+
ret = virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
583+
&cache_ent);
584+
if (ret)
585+
return ret;
584586
virtio_gpu_notify(vgdev);
585587

586588
copy_exit:

0 commit comments

Comments
 (0)