summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-11-09 11:27:43 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-11-09 11:27:43 +0000
commitbacb568617ef7ab22d535a3771d2975e9f2664f3 (patch)
tree24faceb455466c53e154f36c76e163977037c3f7 /sys/dev/pci
parente11fc656698a8bb81966cd8e913e1e1154e38f2a (diff)
drm/amdgpu: fix memory leak
From Nirmoy Das f2824a020746ec60fbb780756e42ac13efb221d0 in linux 4.19.y/4.19.82 083164dbdb17c5ea4ad92c1782b59c9d75567790 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/amd/amdgpu/amdgpu_bo_list.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_bo_list.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_bo_list.c
index 6649891543f..38747fa1909 100644
--- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_bo_list.c
+++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_bo_list.c
@@ -267,7 +267,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
r = amdgpu_bo_create_list_entry_array(&args->in, &info);
if (r)
- goto error_free;
+ return r;
switch (args->in.operation) {
case AMDGPU_BO_LIST_OP_CREATE:
@@ -280,8 +280,7 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
r = idr_alloc(&fpriv->bo_list_handles, list, 1, 0, GFP_KERNEL);
mutex_unlock(&fpriv->bo_list_lock);
if (r < 0) {
- amdgpu_bo_list_put(list);
- return r;
+ goto error_put_list;
}
handle = r;
@@ -303,9 +302,8 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
mutex_unlock(&fpriv->bo_list_lock);
if (IS_ERR(old)) {
- amdgpu_bo_list_put(list);
r = PTR_ERR(old);
- goto error_free;
+ goto error_put_list;
}
amdgpu_bo_list_put(old);
@@ -322,8 +320,10 @@ int amdgpu_bo_list_ioctl(struct drm_device *dev, void *data,
return 0;
+error_put_list:
+ amdgpu_bo_list_put(list);
+
error_free:
- if (info)
- kvfree(info);
+ kvfree(info);
return r;
}