Skip to content

Commit fdcc789

Browse files
mikuintjnikula
authored andcommitted
drm/i915: Fix memleak in runtime wakeref tracking
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 <[email protected]> Cc: Juha-Pekka Heikkila <[email protected]> Cc: Chris Wilson <[email protected]> Signed-off-by: Mika Kuoppala <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Chris Wilson <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit c5f846e) Signed-off-by: Jani Nikula <[email protected]>
1 parent cf8f9aa commit fdcc789

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

drivers/gpu/drm/i915/intel_runtime_pm.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,11 @@ __untrack_all_wakerefs(struct intel_runtime_pm_debug *debug,
221221
static void
222222
dump_and_free_wakeref_tracking(struct intel_runtime_pm_debug *debug)
223223
{
224-
struct drm_printer p;
224+
if (debug->count) {
225+
struct drm_printer p = drm_debug_printer("i915");
225226

226-
if (!debug->count)
227-
return;
228-
229-
p = drm_debug_printer("i915");
230-
__print_intel_runtime_pm_wakeref(&p, debug);
227+
__print_intel_runtime_pm_wakeref(&p, debug);
228+
}
231229

232230
kfree(debug->owners);
233231
}

0 commit comments

Comments
 (0)