Skip to content

Commit 4252fbc

Browse files
vsyrjaladanvet
authored andcommitted
drm/i915: Protect pipe_crc->entries update
Set the pipe_crc->entries pointer while holding the relevant spinlock. Doesn't matter too much since a spurious pipe crc interrupt would then just update one entry but later that entry would get cleared when head and tail are both set to 0. But being a bit more paranoid doesn't hurt. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 2be5792 commit 4252fbc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3410,13 +3410,15 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
34103410

34113411
/* none -> real source transition */
34123412
if (source) {
3413+
struct intel_pipe_crc_entry *entries;
3414+
34133415
DRM_DEBUG_DRIVER("collecting CRCs for pipe %c, %s\n",
34143416
pipe_name(pipe), pipe_crc_source_name(source));
34153417

3416-
pipe_crc->entries = kzalloc(sizeof(*pipe_crc->entries) *
3417-
INTEL_PIPE_CRC_ENTRIES_NR,
3418-
GFP_KERNEL);
3419-
if (!pipe_crc->entries)
3418+
entries = kzalloc(sizeof(*pipe_crc->entries) *
3419+
INTEL_PIPE_CRC_ENTRIES_NR,
3420+
GFP_KERNEL);
3421+
if (!entries)
34203422
return -ENOMEM;
34213423

34223424
/*
@@ -3428,6 +3430,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
34283430
hsw_disable_ips(crtc);
34293431

34303432
spin_lock_irq(&pipe_crc->lock);
3433+
pipe_crc->entries = entries;
34313434
pipe_crc->head = 0;
34323435
pipe_crc->tail = 0;
34333436
spin_unlock_irq(&pipe_crc->lock);

0 commit comments

Comments
 (0)