Skip to content

Commit 973dd87

Browse files
tursulinrodrigovivi
authored andcommitted
drm/i915: Avoid memory leak with more than 16 workarounds on a list
I forgot to free the old list when growing past 16 entries. Luckily, as much as I checked, none of the current platforms has more than 16 workarounds on a single list. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Fixes: 452420d ("drm/i915: Fuse per-context workaround handling with the common framework") Reported-by: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Link: https://patchwork.freedesktop.org/patch/msgid/20201113132510.2298483-1-tvrtko.ursulin@linux.intel.com (cherry picked from commit 77c2969) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 85a12d7 commit 973dd87

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/gpu/drm/i915/gt/intel_workarounds.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,10 @@ static void _wa_add(struct i915_wa_list *wal, const struct i915_wa *wa)
131131
return;
132132
}
133133

134-
if (wal->list)
134+
if (wal->list) {
135135
memcpy(list, wal->list, sizeof(*wa) * wal->count);
136+
kfree(wal->list);
137+
}
136138

137139
wal->list = list;
138140
}

0 commit comments

Comments
 (0)