提交 bd63f11f 编写于 作者: X Xiaomeng Tong 提交者: Gerd Hoffmann

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: 62fb7a5e ("virtio-gpu: add 3d/virgl support")
Signed-off-by: NXiaomeng Tong <xiam0nd.tong@gmail.com>
Reviewed-by: NChia-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: NGerd Hoffmann <kraxel@redhat.com>
上级 6aed665f
...@@ -580,8 +580,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev, ...@@ -580,8 +580,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
spin_unlock(&vgdev->display_info_lock); spin_unlock(&vgdev->display_info_lock);
/* not in cache - need to talk to hw */ /* not in cache - need to talk to hw */
virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, ret = virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver,
&cache_ent); &cache_ent);
if (ret)
return ret;
virtio_gpu_notify(vgdev); virtio_gpu_notify(vgdev);
copy_exit: copy_exit:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册