diff options
| author | Roberto Sassu <[email protected]> | 2021-12-13 18:31:22 +0000 |
|---|---|---|
| committer | Gerd Hoffmann <[email protected]> | 2022-01-18 06:52:42 +0000 |
| commit | 6b79f96f4a23846516e5e6e4dd37fc06f43a60dd (patch) | |
| tree | 49bf2df595d1aef423028624a11e41e93a840c4b /drivers/gpu/drm/virtio/virtgpu_gem.c | |
| parent | udmabuf: validate ubuf->pagecount (diff) | |
| download | kernel-6b79f96f4a23846516e5e6e4dd37fc06f43a60dd.tar.gz kernel-6b79f96f4a23846516e5e6e4dd37fc06f43a60dd.zip | |
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: [email protected] # 5.13.x
Signed-off-by: Roberto Sassu <[email protected]>
Reported-by: [email protected]
Fixes: 377f8331d0565 ("drm/virtio: fix possible leak/unlock virtio_gpu_object_array")
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
Diffstat (limited to 'drivers/gpu/drm/virtio/virtgpu_gem.c')
| -rw-r--r-- | drivers/gpu/drm/virtio/virtgpu_gem.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/virtio/virtgpu_gem.c b/drivers/gpu/drm/virtio/virtgpu_gem.c index 2de61b63ef91..48d3c9955f0d 100644 --- a/drivers/gpu/drm/virtio/virtgpu_gem.c +++ b/drivers/gpu/drm/virtio/virtgpu_gem.c @@ -248,6 +248,9 @@ void virtio_gpu_array_put_free(struct virtio_gpu_object_array *objs) { u32 i; + if (!objs) + return; + for (i = 0; i < objs->nents; i++) drm_gem_object_put(objs->objs[i]); virtio_gpu_array_free(objs); |
