瀏覽代碼

drm/i915: Protect against leaks in pipe_crc_set_source

Stupid userspace (there is no evil userspace in debugfs by assumption)
might provoke a leak since we allocate the new array without holding
any locks. Drop in an unconditional kfree to deal with this - kfree
can handle NULL.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Daniel Vetter 11 年之前
父節點
當前提交
64387b613a
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      drivers/gpu/drm/i915/i915_debugfs.c

+ 1 - 0
drivers/gpu/drm/i915/i915_debugfs.c

@@ -3433,6 +3433,7 @@ static int pipe_crc_set_source(struct drm_device *dev, enum pipe pipe,
 		hsw_disable_ips(crtc);
 
 		spin_lock_irq(&pipe_crc->lock);
+		kfree(pipe_crc->entries);
 		pipe_crc->entries = entries;
 		pipe_crc->head = 0;
 		pipe_crc->tail = 0;