Skip to content

Commit

Permalink
drm/xe/eustall: Fix a possible pointer dereference after free
Browse files Browse the repository at this point in the history
If devm_add_action_or_reset() isn't successful, xe_eu_stall_fini()
is invoked. So, unsuccessful return from devm_add_action_or_reset()
shouldn't dereference gt->eu_stall as xe_eu_stall_fini() already
frees it. Fix this issue.

Fixes: 9a0b11d ("drm/xe/eustall: Add support to init, enable and disable EU stall sampling")
Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/eae49a414a7314921108e0388810aaee6261ad92.1741800396.git.harish.chegondi@intel.com
  • Loading branch information
Harish Chegondi authored and Ashutosh Dixit committed Mar 13, 2025
1 parent 80bcbdf commit 278469f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions drivers/gpu/drm/xe/xe_eu_stall.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,7 @@ int xe_eu_stall_init(struct xe_gt *gt)
goto exit_free;
}

ret = devm_add_action_or_reset(xe->drm.dev, xe_eu_stall_fini, gt);
if (ret)
goto exit_destroy;

return 0;
exit_destroy:
destroy_workqueue(gt->eu_stall->buf_ptr_poll_wq);
return devm_add_action_or_reset(xe->drm.dev, xe_eu_stall_fini, gt);
exit_free:
mutex_destroy(&gt->eu_stall->stream_lock);
kfree(gt->eu_stall);
Expand Down

0 comments on commit 278469f

Please sign in to comment.