drm/bridge: it6505: fix HDCP V match check is not performed correctly
authorHermes Wu <Hermes.wu@ite.com.tw>
Tue, 21 Jan 2025 07:01:51 +0000 (15:01 +0800)
committerRobert Foss <rfoss@kernel.org>
Thu, 6 Feb 2025 13:40:47 +0000 (14:40 +0100)
Fix a typo where V compare incorrectly compares av[] with av[] itself,
which can result in HDCP failure.

The loop of V compare is expected to iterate for 5 times
which compare V array form av[0][] to av[4][].
It should check loop counter reach the last statement "i == 5"
before return true

Fixes: 0989c02c7a5c ("drm/bridge: it6505: fix HDCP CTS compare V matching")
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250121-fix-hdcp-v-comp-v4-1-185f45c728dc@ite.com.tw
drivers/gpu/drm/bridge/ite-it6505.c

index 88ef76a37fe6accacdd343839ff2569b31b18ceb..76dabca04d0d191b3bdee23c6a3e55f4b6d3bad4 100644 (file)
@@ -2250,12 +2250,13 @@ static bool it6505_hdcp_part2_ksvlist_check(struct it6505 *it6505)
                        continue;
                }
 
-               for (i = 0; i < 5; i++) {
+               for (i = 0; i < 5; i++)
                        if (bv[i][3] != av[i][0] || bv[i][2] != av[i][1] ||
-                           av[i][1] != av[i][2] || bv[i][0] != av[i][3])
+                           bv[i][1] != av[i][2] || bv[i][0] != av[i][3])
                                break;
 
-                       DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d, %d", retry, i);
+               if (i == 5) {
+                       DRM_DEV_DEBUG_DRIVER(dev, "V' all match!! %d", retry);
                        return true;
                }
        }