Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

virtio-gpu: fix a missing check to avoid NULL dereference

'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: 62fb7a5e10962 ("virtio-gpu: add 3d/virgl support")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20220327050945.1614-1-xiam0nd.tong@gmail.com

[ kraxel: minor codestyle fixup ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

authored by

Xiaomeng Tong and committed by
Gerd Hoffmann
bd63f11f 6aed665f

+4 -2
+4 -2
drivers/gpu/drm/virtio/virtgpu_ioctl.c
··· 580 580 spin_unlock(&vgdev->display_info_lock); 581 581 582 582 /* not in cache - need to talk to hw */ 583 - virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, 584 - &cache_ent); 583 + ret = virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, 584 + &cache_ent); 585 + if (ret) 586 + return ret; 585 587 virtio_gpu_notify(vgdev); 586 588 587 589 copy_exit: