]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit02e57eabda7899f17011616be9b7706241f68e60
tree64b77fe2043994618dd2366a2eb7fef0a0eac253
parent41c62a3b6ec7b32f995db1cf61f4fdffbcadd7a1
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: f8b6285be2964 ("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