Re: [PATCH next] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc()

2025-04-12 Thread Dan Carpenter
On Thu, Apr 10, 2025 at 10:29:31PM +0530, Yadav, Arvind wrote: > Please change this also instead of 'goto free_fence_drv' just return err. > >     fence_drv = kzalloc(sizeof(*fence_drv), GFP_KERNEL); >     if (!fence_drv) { >     DRM_ERROR("Failed to allocate memory for fence d

Re: [PATCH next] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc()

2025-04-10 Thread Yadav, Arvind
Please change this also instead of 'goto free_fence_drv' just return err.     fence_drv = kzalloc(sizeof(*fence_drv), GFP_KERNEL);     if (!fence_drv) {     DRM_ERROR("Failed to allocate memory for fence driver\n");     r = -ENOMEM;     goto free_fence_

[PATCH next] drm/amdgpu: Fix double free in amdgpu_userq_fence_driver_alloc()

2025-04-10 Thread Dan Carpenter
The goto frees "fence_drv" so this is a double free bug. There is no need to call amdgpu_seq64_free(adev, fence_drv->va) since the seq64 allocation failed so change the goto to goto free_fence_drv. Also propagate the error code from amdgpu_seq64_alloc() instead of hard coding it to -ENOMEM. Fixe