drm/vc4: Fix termination of the initial scan for branch targets.
authorEric Anholt <eric@anholt.net>
Thu, 20 Oct 2016 23:48:12 +0000 (16:48 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 26 Mar 2017 11:05:56 +0000 (13:05 +0200)
commitdd0b0e22a58875e0ea9f41fc177f2286dddc95ab
treeb814dfb5663564aa10a76760b3d0b82ea0492010
parentc3825da143fc419e2639e602f62d793ed0de4657
drm/vc4: Fix termination of the initial scan for branch targets.

commit 457e67a728696c4f8e6423c64e93def50530db9a upstream.

The loop is scanning until the original max_ip (size of the BO), but
we want to not examine any code after the PROG_END's delay slots.
There was a block trying to do that, except that we had some early
continue statements if the signal wasn't a PROG_END or a BRANCH.

The failure mode would be that a valid shader is rejected because some
undefined memory after the PROG_END slots is parsed as a branch and
the rest of its setup is illegal.  I haven't seen this in the wild,
but valgrind was complaining when about this up in the userland
simulator mode.

Signed-off-by: Eric Anholt <eric@anholt.net>
Cc: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/vc4/vc4_validate_shaders.c