[Intel-gfx] [PATCH] drm/i915: Do not leak objects after capturing error state

Michel Thierry michel.thierry at intel.com
Thu Mar 19 10:49:44 PDT 2015


On 3/19/2015 5:18 PM, Chris Wilson wrote:
> On Thu, Mar 19, 2015 at 05:11:17PM +0000, Michel Thierry wrote:
>> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
>> index bbf25d0..18f7a2a 100644
>> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
>> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
>> @@ -545,7 +545,7 @@ static void i915_error_state_free(struct kref *error_ref)
>>   {
>>   	struct drm_i915_error_state *error = container_of(error_ref,
>>   							  typeof(*error), ref);
>> -	int i;
>> +	int i, j;
> No need for a new iterator.
Ok, I'll reuse 'i'.
>>   	for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
>>   		i915_error_object_free(error->ring[i].batchbuffer);
>> @@ -556,7 +556,14 @@ static void i915_error_state_free(struct kref *error_ref)
>>   	}
>>   
>>   	i915_error_object_free(error->semaphore_obj);
>> +
>> +	for (i = 0; i < error->vm_count; i++)
>> +		kfree(error->active_bo[i]);
> 		kfree(error->pinned_bo[i]);
>
> Pinned_bo is also an overlooked array of pointers.
But pinned_bo elements were not explicitly allocated with kcalloc.
I'd get warnings that they are already freed.

Thanks
> -Chris
>


More information about the Intel-gfx mailing list