Merge tag 'drm-fixes-5.4-2019-10-09' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
drm-fixes-5.4-2019-10-09: amdgpu: - fix memory leak in bo_list ioctl error path Signed-off-by: Dave Airlie <airlied@redhat.com> From: Alex Deucher <alexdeucher@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20191010031023.23359-1-alexander.deucher@amd.com
This commit is contained in:
commit
46fe219d7c
|
@ -270,7 +270,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
|
||||||
|
|
||||||
r = amdgpu_bo_create_list_entry_array(&args->in, &info);
|
r = amdgpu_bo_create_list_entry_array(&args->in, &info);
|
||||||
if (r)
|
if (r)
|
||||||
goto error_free;
|
return r;
|
||||||
|
|
||||||
switch (args->in.operation) {
|
switch (args->in.operation) {
|
||||||
case AMDGPU_BO_LIST_OP_CREATE:
|
case AMDGPU_BO_LIST_OP_CREATE:
|
||||||
|
@ -283,8 +283,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
|
||||||
r = idr_alloc(&fpriv->bo_list_handles, list, 1, 0, GFP_KERNEL);
|
r = idr_alloc(&fpriv->bo_list_handles, list, 1, 0, GFP_KERNEL);
|
||||||
mutex_unlock(&fpriv->bo_list_lock);
|
mutex_unlock(&fpriv->bo_list_lock);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
amdgpu_bo_list_put(list);
|
goto error_put_list;
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handle = r;
|
handle = r;
|
||||||
|
@ -306,9 +305,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
|
||||||
mutex_unlock(&fpriv->bo_list_lock);
|
mutex_unlock(&fpriv->bo_list_lock);
|
||||||
|
|
||||||
if (IS_ERR(old)) {
|
if (IS_ERR(old)) {
|
||||||
amdgpu_bo_list_put(list);
|
|
||||||
r = PTR_ERR(old);
|
r = PTR_ERR(old);
|
||||||
goto error_free;
|
goto error_put_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
amdgpu_bo_list_put(old);
|
amdgpu_bo_list_put(old);
|
||||||
|
@ -325,8 +323,10 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error_put_list:
|
||||||
|
amdgpu_bo_list_put(list);
|
||||||
|
|
||||||
error_free:
|
error_free:
|
||||||
if (info)
|
|
||||||
kvfree(info);
|
kvfree(info);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue