[Intel-gfx] [PATCH] drm/i915: Do not leak objects after capturing error state
Chris Wilson
chris at chris-wilson.co.uk
Thu Mar 19 14:02:15 PDT 2015
On Thu, Mar 19, 2015 at 05:49:44PM +0000, Michel Thierry wrote:
> 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.
I was wrong. I thought we allocated a single array for both, then
managed to convince myself we had two allocs (one for the pinned_bo and
one for the active_bo).
FWIW, as penance, the regression is from
commit 95f5301dd880da2dea2c9a9c29750064536d426a
Author: Ben Widawsky <ben at bwidawsk.net>
Date: Wed Jul 31 17:00:15 2013 -0700
drm/i915: Update error capture for VMs
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list