Skip to contentSkip to conversation

drm/amdgpu: cleanup on error in amdgpu_cs_ioctl()

PATCH Applied Dan Carpenter 3 participants 3 messages Nov 4, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu: cleanup on error in amdgpu_cs_ioctl()

We recently changed the locking in this function and now there is a missing unlock on error. Also there are some other resources that we should probably release as well...

Fixes f48b2659f521 ('drm/amdgpu: fix the broken vm->mutex V2')

---
I'm not terribly familiar with this code. Please review this one a bit carefully.

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -2
index 27ef528..dfc4d02 100644
@@ -876,8 +876,10 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
 		struct amdgpu_job *job;
 		struct amdgpu_ring * ring =  parser->ibs->ring;
 		job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL);
-		if (!job)
-			return -ENOMEM;
+		if (!job) {
+			r = -ENOMEM;
+			goto out;
+		}
 		job->base.sched = &ring->sched;
 		job->base.s_entity = &parser->ctx->rings[ring->idx].entity;
 		job->adev = parser->adev;
#1 lore raw
Quoted 6 lines · Dan Carpenter

We recently changed the locking in this function and now there is a missing unlock on error. Also there are some other resources that we should probably release as well...

Fixes f48b2659f521 ('drm/amdgpu: fix the broken vm->mutex V2')

Yeah indeed, thanks for catching this.

Patch is Reviewed-by: Christian König <[email protected]>

Quoted 11 lines

---
I'm not terribly familiar with this code. Please review this one a bit carefully.

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +0 -0
index 27ef528..dfc4d02 100644
@@ -876,8 +876,10 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
  		struct amdgpu_job *job;
  		struct amdgpu_ring * ring =  parser->ibs->ring;

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c int amdgpu_cs_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) · line 885

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -2
  		job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL);
-		if (!job)
-			return -ENOMEM;
+		if (!job) {
+			r = -ENOMEM;
+			goto out;
+		}
  		job->base.sched = &ring->sched;
  		job->base.s_entity = &parser->ctx->rings[ring->idx].entity;
  		job->adev = parser->adev;

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#2 lore raw
Quoted 6 lines · Christian König
Quoted 5 lines · Dan Carpenter

We recently changed the locking in this function and now there is a missing unlock on error. Also there are some other resources that we should probably release as well...

Quoted 7 lines
Quoted 2 lines
Fixes f48b2659f521 ('drm/amdgpu: fix the broken vm->mutex V2')

Yeah indeed, thanks for catching this.

Patch is Reviewed-by: Christian König <[email protected]>

Applied. thanks!

Alex

Quoted 24 lines
Quoted 24 lines

---
I'm not terribly familiar with this code. Please review this one a bit carefully.

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +4 -2
index 27ef528..dfc4d02 100644
@@ -876,8 +876,10 @@ int amdgpu_cs_ioctl(struct drm_device *dev, void
 *data, struct drm_file *filp)
                struct amdgpu_job *job;
                struct amdgpu_ring * ring =  parser->ibs->ring;
                job = kzalloc(sizeof(struct amdgpu_job), GFP_KERNEL);
-               if (!job)
-                       return -ENOMEM;
+               if (!job) {
+                       r = -ENOMEM;
+                       goto out;
+               }
                job->base.sched = &ring->sched;
                job->base.s_entity =
Quoted 8 lines
Quoted 2 lines
&parser->ctx->rings[ring->idx].entity;
                job->adev = parser->adev;

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html