diff options
author | Jonathan Cavitt <jonathan.cavitt@intel.com> | 2025-09-04 19:30:42 +0000 |
---|---|---|
committer | Andi Shyti <andi.shyti@linux.intel.com> | 2025-09-09 17:58:19 +0200 |
commit | f8d2c26df98b487d61e582c01804340b96c44e44 (patch) | |
tree | 19e4fa2ea04f21923f915a2b4ae107f083d6be28 /rust/helpers/helpers.c | |
parent | 82b13dd5d93d9d170c096f042eb470add22c338c (diff) |
drm/i915/gt: Fix memory leak in hangcheck selftest
In active_engines, if intel_context_create fails, we need to go
backwards through all the created contexts to free/put them. However,
the way this is currently performed skips the first created context, as
if count == 1, then --count returns 0 and exits the while-loop
prematurely without performing the intel_context_put on context 0.
Fix this by post-decrementing count in the while-loop, rather than
pre-decrementing it. This change makes the prior guard against count
underflowing unnecessary, as the while-loop exits when count == 0.
Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
Cc: Krzysztof Karas <krzysztof.karas@intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://lore.kernel.org/r/20250904193041.12888-2-jonathan.cavitt@intel.com
Diffstat (limited to 'rust/helpers/helpers.c')
0 files changed, 0 insertions, 0 deletions