In case num_read_bo_handles or num_write_bo_handles is zero the ptrs
remain uninitialized and during free cause a fault. So to handle such
cases we better set the gobj_read and gobj_write to NULL.

Fixes: 42e01090a47c ("drm/amdgpu/userq: Use drm_gem_objects_lookup in 
amdgpu_userq_wait_ioctl")
Signed-off-by: Sunil Khatri <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index e53e14e3bf2d..42b548c8a86e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -617,7 +617,7 @@ int amdgpu_userq_wait_ioctl(struct drm_device *dev, void 
*data,
        struct drm_amdgpu_userq_fence_info *fence_info = NULL;
        struct amdgpu_fpriv *fpriv = filp->driver_priv;
        struct amdgpu_userq_mgr *userq_mgr = &fpriv->userq_mgr;
-       struct drm_gem_object **gobj_write, **gobj_read;
+       struct drm_gem_object **gobj_write = NULL, **gobj_read = NULL;
        u32 *timeline_points, *timeline_handles;
        struct amdgpu_usermode_queue *waitq;
        u32 *syncobj_handles, num_syncobj;
-- 
2.34.1

Reply via email to