kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] drm/amdgpu: cleanup on error in amdgpu_cs_ioctl()
@ 2015-11-04 13:25 Dan Carpenter
  2015-11-04 14:10 ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2015-11-04 13:25 UTC (permalink / raw)
  To: David Airlie, Chunming Zhou
  Cc: Marek Olšák, kernel-janitors, dri-devel, Alex Deucher,
	Christian König, monk.liu

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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I'm not terribly familiar with this code.  Please review this one a bit
carefully.

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index 27ef528..dfc4d02 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] drm/amdgpu: cleanup on error in amdgpu_cs_ioctl()
  2015-11-04 13:25 [patch] drm/amdgpu: cleanup on error in amdgpu_cs_ioctl() Dan Carpenter
@ 2015-11-04 14:10 ` Christian König
  2015-11-04 17:15   ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: Christian König @ 2015-11-04 14:10 UTC (permalink / raw)
  To: Dan Carpenter, David Airlie, Chunming Zhou
  Cc: Marek Olšák, kernel-janitors, dri-devel, Alex Deucher,
	monk.liu

On 04.11.2015 14:25, Dan Carpenter wrote:
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Yeah indeed, thanks for catching this.

Patch is Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
> I'm not terribly familiar with this code.  Please review this one a bit
> carefully.
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 27ef528..dfc4d02 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -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;

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] drm/amdgpu: cleanup on error in amdgpu_cs_ioctl()
  2015-11-04 14:10 ` Christian König
@ 2015-11-04 17:15   ` Alex Deucher
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Deucher @ 2015-11-04 17:15 UTC (permalink / raw)
  To: Christian König
  Cc: Dan Carpenter, David Airlie, Chunming Zhou,
	Marek Olšák, kernel-janitors,
	Maling list - DRI developers, Alex Deucher, monk.liu

On Wed, Nov 4, 2015 at 9:10 AM, Christian König <deathsimple@vodafone.de> wrote:
> On 04.11.2015 14:25, Dan Carpenter wrote:
>>
>> 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')
>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
>
> Yeah indeed, thanks for catching this.
>
> Patch is Reviewed-by: Christian König <christian.koenig@amd.com>


Applied.  thanks!

Alex

>
>
>> ---
>> I'm not terribly familiar with this code.  Please review this one a bit
>> carefully.
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> index 27ef528..dfc4d02 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
>> @@ -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;
>
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-04 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-04 13:25 [patch] drm/amdgpu: cleanup on error in amdgpu_cs_ioctl() Dan Carpenter
2015-11-04 14:10 ` Christian König
2015-11-04 17:15   ` Alex Deucher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).