Skip to content

Commit

Permalink
drm/msm/a6xx: Remove state objects from list before freeing
Browse files Browse the repository at this point in the history
Technically it worked as it was before, only because it was using the
_safe version of the iterator.  But it is sloppy practice to leave
dangling pointers.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/507017/
Link: https://lore.kernel.org/r/20221013225520.371226-4-robdclark@gmail.com
  • Loading branch information
Rob Clark committed Oct 14, 2022
1 parent fab384c commit ec4fbd7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,10 @@ static void a6xx_gpu_state_destroy(struct kref *kref)
if (a6xx_state->gmu_debug)
kvfree(a6xx_state->gmu_debug->data);

list_for_each_entry_safe(obj, tmp, &a6xx_state->objs, node)
list_for_each_entry_safe(obj, tmp, &a6xx_state->objs, node) {
list_del(&obj->node);
kvfree(obj);
}

adreno_gpu_state_destroy(state);
kfree(a6xx_state);
Expand Down

0 comments on commit ec4fbd7

Please sign in to comment.