]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915/cmdparser: Fix jump whitelist clearing
authorBen Hutchings <ben@decadent.org.uk>
Mon, 11 Nov 2019 16:13:24 +0000 (08:13 -0800)
committerJon Bloomfield <jon.bloomfield@intel.com>
Mon, 11 Nov 2019 16:13:49 +0000 (08:13 -0800)
commita91645ab7ef512507581bbece870effcbc667ed0
tree4a97f4f6d41aa4ff48665efca84562b3affa19a8
parentaedb3263362cfd212948a859b0bcfa46823e9519
drm/i915/cmdparser: Fix jump whitelist clearing

When a jump_whitelist bitmap is reused, it needs to be cleared.
Currently this is done with memset() and the size calculation assumes
bitmaps are made of 32-bit words, not longs.  So on 64-bit
architectures, only the first half of the bitmap is cleared.

If some whitelist bits are carried over between successive batches
submitted on the same context, this will presumably allow embedding
the rogue instructions that we're trying to reject.

Use bitmap_zero() instead, which gets the calculation right.

Fixes: d0bef4eb0f74 ("drm/i915/cmdparser: Add support for backward jumps")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jon Bloomfield <jon.bloomfield@intel.com>
drivers/gpu/drm/i915/i915_cmd_parser.c