Skip to content

Commit dc2d984

Browse files
ShuichengLinrodrigovivi
authored andcommitted
drm/xe/eustall: Fix drm_dev_put called before stream disable in close
In xe_eu_stall_stream_close(), drm_dev_put() is called before the stream is disabled and its resources are freed. If this drops the last reference, the device structures could be freed while the subsequent cleanup code still accesses them, leading to a use-after-free. Fix this by moving drm_dev_put() after all device accesses are complete. This matches the ordering in xe_oa_release(). Fixes: 9a0b11d ("drm/xe/eustall: Add support to init, enable and disable EU stall sampling") Cc: Harish Chegondi <harish.chegondi@intel.com> Assisted-by: Claude:claude-opus-4.6 Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com> Reviewed-by: Harish Chegondi <harish.chegondi@intel.com> Link: https://patch.msgid.link/20260415225428.3399934-1-shuicheng.lin@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com> (cherry picked from commit 35aff52) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent f3cc22d commit dc2d984

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/xe/xe_eu_stall.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -869,14 +869,14 @@ static int xe_eu_stall_stream_close(struct inode *inode, struct file *file)
869869
struct xe_eu_stall_data_stream *stream = file->private_data;
870870
struct xe_gt *gt = stream->gt;
871871

872-
drm_dev_put(&gt->tile->xe->drm);
873-
874872
mutex_lock(&gt->eu_stall->stream_lock);
875873
xe_eu_stall_disable_locked(stream);
876874
xe_eu_stall_data_buf_destroy(stream);
877875
xe_eu_stall_stream_free(stream);
878876
mutex_unlock(&gt->eu_stall->stream_lock);
879877

878+
drm_dev_put(&gt->tile->xe->drm);
879+
880880
return 0;
881881
}
882882

0 commit comments

Comments
 (0)