]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/query: Protect tainted function pointer lookup
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 21 May 2018 21:05:30 +0000 (22:05 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 22 May 2018 09:47:07 +0000 (10:47 +0100)
commit156ae664cff92edf61abee444371355b0300ad8e
tree2727b27a6fe7db45f7d973f340d09d42d52ed305
parent942b649bdfd2154aae69b0a31ed507788cde7cad
drm/i915/query: Protect tainted function pointer lookup

Smatch identifies i915_query_ioctl() as being a potential victim of
Spectre due to its use of a tainted user index into a function pointer
array. Use array_index_nospec() to defang the user index before using it
to lookup the function pointer.

Fixes: 7a5f0b5b7a5b ("drm/i915: add query uAPI")
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180521210530.26008-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_query.c