Skip to content

Commit

Permalink
drm/i915: Fix memleak in runtime wakeref tracking
Browse files Browse the repository at this point in the history
If we untrack wakerefs, the actual count may reach zero.
However the krealloced owners array is still there and
needs to be taken care of. Free the owners unconditionally
to fix the leak.

Fixes: bd780f3 ("drm/i915: Track all held rpm wakerefs")
Reported-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190701104442.9319-1-mika.kuoppala@linux.intel.com
(cherry picked from commit c5f846e)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
  • Loading branch information
Mika Kuoppala authored and Jani Nikula committed Jul 29, 2019
1 parent cf8f9aa commit fdcc789
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/gpu/drm/i915/intel_runtime_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,11 @@ __untrack_all_wakerefs(struct intel_runtime_pm_debug *debug,
static void
dump_and_free_wakeref_tracking(struct intel_runtime_pm_debug *debug)
{
struct drm_printer p;
if (debug->count) {
struct drm_printer p = drm_debug_printer("i915");

if (!debug->count)
return;

p = drm_debug_printer("i915");
__print_intel_runtime_pm_wakeref(&p, debug);
__print_intel_runtime_pm_wakeref(&p, debug);
}

kfree(debug->owners);
}
Expand Down

0 comments on commit fdcc789

Please sign in to comment.