drm/i915: prevent division by zero when asking for chipset power
This prevents an in-kernel division by zero which happens when we are asking for i915_chipset_val too quickly, or within a race condition between the power monitoring thread and userspace accesses via debugfs. The issue can be reproduced easily via the following command: while ``; do cat /sys/kernel/debug/dri/0/i915_emon_status; done This is particularly dangerous because it can be triggered by a non-privileged user by just reading the debugfs entry. This issue was also found independently by Konstantin Belousov <kostikbel@gmail.com>, who proposed a similar patch. Reported-by: NKonstantin Belousov <kostikbel@gmail.com> Acked-by: NJesse Barnes <jbarnes@virtuousgeek.org> Acked-by: NKeith Packard <keithp@keithp.com> Reviewed-by: NChris Wilson <chris@chris-wilson.co.uk> Cc: <stable@vger.kernel.org> Signed-off-by: NEugeni Dodonov <eugeni.dodonov@intel.com> Signed-off-by: NKeith Packard <keithp@keithp.com>
Showing
想要评论请 注册 或 登录