Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Fix HDCP failures when SRM fw is missing

The SRM cleanup in 79643fddd6eb2 ("drm/hdcp: optimizing the srm
handling") inadvertently altered the behavior of HDCP auth when
the SRM firmware is missing. Before that patch, missing SRM was
interpreted as the device having no revoked keys. With that patch,
if the SRM fw file is missing we reject _all_ keys.

This patch fixes that regression by returning success if the file
cannot be found. It also checks the return value from request_srm such
that we won't end up trying to parse the ksv list if there is an error
fetching it.

Fixes: 79643fddd6eb ("drm/hdcp: optimizing the srm handling")
Cc: stable@vger.kernel.org
Cc: Ramalingam C <ramalingam.c@intel.com>
Cc: Sean Paul <sean@poorly.run>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200414190258.38873-1-sean@poorly.run

Changes in v2:
-Noticed a couple other things to clean up
Reviewed-by: Ramalingam C <ramalingam.c@intel.com>

+7 -1
+7 -1
drivers/gpu/drm/drm_hdcp.c
··· 241 241 242 242 ret = request_firmware_direct(&fw, (const char *)fw_name, 243 243 drm_dev->dev); 244 - if (ret < 0) 244 + if (ret < 0) { 245 + *revoked_ksv_cnt = 0; 246 + *revoked_ksv_list = NULL; 247 + ret = 0; 245 248 goto exit; 249 + } 246 250 247 251 if (fw->size && fw->data) 248 252 ret = drm_hdcp_srm_update(fw->data, fw->size, revoked_ksv_list, ··· 291 287 292 288 ret = drm_hdcp_request_srm(drm_dev, &revoked_ksv_list, 293 289 &revoked_ksv_cnt); 290 + if (ret) 291 + return ret; 294 292 295 293 /* revoked_ksv_cnt will be zero when above function failed */ 296 294 for (i = 0; i < revoked_ksv_cnt; i++)