From: Ville Syrjälä Date: Tue, 9 Dec 2014 19:28:32 +0000 (+0200) Subject: drm/i915: Make i915_pipe_crc_read() oops proof X-Git-Tag: fixes-v4.0-rc1~91^2~43^2~33 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ad6d99f189c274b42bedd6efc2b31a17ce733a7;p=pandora-kernel.git drm/i915: Make i915_pipe_crc_read() oops proof Currently i915_pipe_crc_read() will drop pipe_crc->lock for the entire duration of the copy_to_user() loop, which means it'll access pipe_crc->entries without any protection. If another thread sneaks in and frees pipe_crc->entries the code will oops. Reorganize the code to hold the lock around everything except copy_to_user(). After the copy the lock is reacquired and the the number of available entries is rechecked. Since this is a debug feature simplify the error handling a bit by consuming the crc entry even if copy_to_user() would fail. Signed-off-by: Ville Syrjälä Signed-off-by: Daniel Vetter --- Reading git-diff-tree failed