OSDN Git Service

virtio-gpu: fix a missing check to avoid NULL dereference
authorXiaomeng Tong <xiam0nd.tong@gmail.com>
Sun, 27 Mar 2022 05:09:45 +0000 (13:09 +0800)
committerGerd Hoffmann <kraxel@redhat.com>
Thu, 9 Jun 2022 05:30:12 +0000 (07:30 +0200)
commitbd63f11f4c3c46afec07d821f74736161ff6e526
tree64b77fe2043994618dd2366a2eb7fef0a0eac253
parent6aed665f9d8368ae1e962f44339150884bb47f5b
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>
drivers/gpu/drm/virtio/virtgpu_ioctl.c