OSDN Git Service

drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()
authorRoberto Sassu <roberto.sassu@huawei.com>
Mon, 13 Dec 2021 18:31:22 +0000 (19:31 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 18 Jan 2022 06:52:42 +0000 (07:52 +0100)
commit6b79f96f4a23846516e5e6e4dd37fc06f43a60dd
tree49bf2df595d1aef423028624a11e41e93a840c4b
parent2b6dd600dd72573c23ea180b5b0b2f1813405882
drm/virtio: Ensure that objs is not NULL in virtio_gpu_array_put_free()

If virtio_gpu_object_shmem_init() fails (e.g. due to fault injection, as it
happened in the bug report by syzbot), virtio_gpu_array_put_free() could be
called with objs equal to NULL.

Ensure that objs is not NULL in virtio_gpu_array_put_free(), or otherwise
return from the function.

Cc: stable@vger.kernel.org # 5.13.x
Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
Reported-by: syzbot+e9072e90624a31dfa85f@syzkaller.appspotmail.com
Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")
Link: http://patchwork.freedesktop.org/patch/msgid/20211213183122.838119-1-roberto.sassu@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
drivers/gpu/drm/virtio/virtgpu_gem.c