FAILED: patch "[PATCH] drm/i915/hdcp: require monotonically increasing seq_num_v" failed to apply to 6.6-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x db9e64c983dcb07ff256bd455f258c44aa530ff8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026072904-impaired-parking-52fc@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From db9e64c983dcb07ff256bd455f258c44aa530ff8 Mon Sep 17 00:00:00 2001
From: Jani Nikula <[email protected]>
Date: Thu, 25 Jun 2026 13:44:07 +0300
Subject: [PATCH] drm/i915/hdcp: require monotonically increasing seq_num_v
The HDCP 2.2 specification requires the seq_num_v to be monotonically increasing, and repeated seq_num_v needs to be treated as an integrity failure. Make it so.
For the first message, seq_num_v must be zero, and is already checked. We can only check for less-than-or-equal for the subsequent messages, where hdcp2_encrypted is true.
Discovered using AI-assisted static analysis confirmed by Intel Product Security.
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -3
@@ -1801,9 +1801,10 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)return -EINVAL ; } -if (seq_num_v < hdcp->seq_num_v) { -/* Roll over of the seq_num_v from repeater. Reauthenticate. */ -drm_dbg_kms (display->drm,"Seq_num_v roll over.\n" ); +if (hdcp->hdcp2_encrypted && seq_num_v <= hdcp->seq_num_v) { +/* Reauthenticate on Seq_num_v repeat or rollover */ +drm_dbg_kms (display->drm,"Seq_num_v %s\n" , + seq_num_v == hdcp->seq_num_v ?"repeat" :"rollover" );return -EINVAL ; }
Sasha Levin
maintainerPATCH 1/4 drm/i915/fbc: Extract intel_fbc_has_fences()
From: Ville Syrjälä <[email protected]>
[ Upstream commit bc34d310b578952d37b5200a7fa7475ab2a2bd5e ]
Pull the "do we have fences?" check into a single helper in the FBC code. Avoids having to call to outside the display code in multiple places for this.
Stable-dep-of: db9e64c983dc ("drm/i915/hdcp: require monotonically increasing seq_num_v")
--- drivers/gpu/drm/i915/display/intel_fbc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_fbc.c +7 -2
@@ -223,6 +223,11 @@ static u16 intel_fbc_override_cfb_stride(const struct intel_plane_state *plane_sreturn 0 ; } +static bool intel_fbc_has_fences (struct drm_i915_private *i915) +{ +return intel_gt_support_legacy_fencing (to_gt (i915)); +} +static u32 i8xx_fbc_ctl (struct intel_fbc *fbc) {const struct intel_fbc_state *fbc_state = &fbc->state;
@@ -608,7 +613,7 @@ static void ivb_fbc_activate(struct intel_fbc *fbc)else if (DISPLAY_VER (i915) ==9 )skl_fbc_program_cfb_stride (fbc); -if (intel_gt_support_legacy_fencing (to_gt (i915))) +if (intel_fbc_has_fences (i915))snb_fbc_program_fence (fbc); intel_de_write(i915, ILK_DPFC_CONTROL(fbc->id),
@@ -992,7 +997,7 @@ static void intel_fbc_update_state(struct intel_atomic_state *state, fbc_state->fence_y_offset =intel_plane_fence_y_offset (plane_state);drm_WARN_ON (&i915->drm, plane_state->flags &PLANE_HAS_FENCE && - !intel_gt_support_legacy_fencing (to_gt (i915))); + !intel_fbc_has_fences (i915));if (plane_state->flags &PLANE_HAS_FENCE ) fbc_state->fence_id =i915_vma_fence_id (plane_state->ggtt_vma);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/4 drm/i915/hdcp: migrate away from kdev_to_i915() in bind/unbind
From: Jani Nikula <[email protected]>
[ Upstream commit 3eac4684ecb5ea696bd283bd7f35e4829973f4f8 ]
Use to_intel_display() instead of kdev_to_i915() in the HDCP component API hooks. Avoid further drive-by changes at this point, and just convert the display pointer to i915, and leave the struct intel_display conversion for later.
Stable-dep-of: db9e64c983dc ("drm/i915/hdcp: require monotonically increasing seq_num_v")
--- drivers/gpu/drm/i915/display/intel_hdcp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +6 -4
@@ -2108,10 +2108,11 @@ static void intel_hdcp_check_work(struct work_struct *work) DRM_HDCP_CHECK_PERIOD_MS); } -static int i915_hdcp_component_bind (struct device *i915_kdev, +static int i915_hdcp_component_bind (struct device *drv_kdev,struct device *mei_kdev,void *data) { -struct drm_i915_private *i915 =kdev_to_i915 (i915_kdev); +struct intel_display *display =to_intel_display (drv_kdev); +struct drm_i915_private *i915 =to_i915 (display->drm);drm_dbg (&i915->drm,"I915 HDCP comp bind\n" );mutex_lock (&i915->display.hdcp.hdcp_mutex);
@@ -2122,10 +2123,11 @@ static int i915_hdcp_component_bind(struct device *i915_kdev,return 0 ; } -static void i915_hdcp_component_unbind (struct device *i915_kdev, +static void i915_hdcp_component_unbind (struct device *drv_kdev,struct device *mei_kdev,void *data) { -struct drm_i915_private *i915 =kdev_to_i915 (i915_kdev); +struct intel_display *display =to_intel_display (drv_kdev); +struct drm_i915_private *i915 =to_i915 (display->drm);drm_dbg (&i915->drm,"I915 HDCP comp unbind\n" );mutex_lock (&i915->display.hdcp.hdcp_mutex);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/4 drm/i915/hdcp: Move to using intel_display in intel_hdcp
In reply to Sasha LevinFrom: Suraj Kandpal <[email protected]>
[ Upstream commit e35bf8f6a0ff06ceeff15bb032351cd5d006f92b ]
Move to using intel_display wherever possible in intel_hdcp.c as a part of code refactor.
--v2
-Move intel_display to the first line wherever possible [Jani] -use the closest reference when using to_intel_display [Jani]
Stable-dep-of: db9e64c983dc ("drm/i915/hdcp: require monotonically increasing seq_num_v")
--- .../gpu/drm/i915/display/intel_display_core.h | 3 + .../drm/i915/display/intel_display_device.c | 3 + .../drm/i915/display/intel_display_types.h | 40 +++ drivers/gpu/drm/i915/display/intel_hdcp.c | 250 +++++++++--------- 4 files changed, 170 insertions(+), 126 deletions(-)
drivers/gpu/drm/i915/display/intel_display_core.h +3 -0
@@ -267,6 +267,9 @@ struct intel_wm { };struct intel_display { +/* drm device backpointer */ +struct drm_device *drm; +/* Display functions */ struct {/* Top level crtc-ish functions */
drivers/gpu/drm/i915/display/intel_display_device.c +3 -0
@@ -857,6 +857,9 @@ intel_display_device_probe(struct drm_i915_private *i915, bool has_gmdid,struct pci_dev *pdev =to_pci_dev (i915->drm.dev);int i; +/* Add drm device backpointer as early as possible. */ + i915->display.drm = &i915->drm; +if (has_gmdid)return probe_gmdid_display (i915, gmdid_ver, gmdid_rel, gmdid_step);
drivers/gpu/drm/i915/display/intel_display_types.h +40 -0
@@ -2112,4 +2112,44 @@ to_intel_frontbuffer(struct drm_framebuffer *fb) return fb ? to_intel_framebuffer(fb)->frontbuffer : NULL; } +/* +* Conversion functions/macros from various pointer types to struct +* intel_display pointer. +*/ +#define __drm_device_to_intel_display (p) \ + ((p) ? &to_i915(p)->display : NULL) +#define __device_to_intel_display (p) \ + __drm_device_to_intel_display(&kdev_to_i915(p)->drm) +#define __intel_connector_to_intel_display (p) \ + __drm_device_to_intel_display((p)->base.dev) +#define __intel_crtc_to_intel_display (p) \ + __drm_device_to_intel_display((p)->base.dev) +#define __intel_crtc_state_to_intel_display (p) \ + __drm_device_to_intel_display((p)->uapi.crtc->dev) +#define __intel_digital_port_to_intel_display (p) \ + __drm_device_to_intel_display((p)->base.base.dev) +#define __intel_dp_to_intel_display (p) \ + __drm_device_to_intel_display(dp_to_dig_port(p)->base.base.dev) +#define __intel_encoder_to_intel_display (p) \ + __drm_device_to_intel_display((p)->base.dev) +#define __intel_hdmi_to_intel_display (p) \ + __drm_device_to_intel_display(hdmi_to_dig_port(p)->base.base.dev) + +/* Helper for generic association. Map types to conversion functions/macros. */ +#define __assoc (type, p) \ + struct type: __##type##_to_intel_display((struct type *)(p)) + +/* Convert various pointer types to struct intel_display pointer. */ +#define to_intel_display (p) \ + _Generic(*p, \ + __assoc(drm_device, p), \ + __assoc(device, p), \ + __assoc(intel_connector, p), \ + __assoc(intel_crtc, p), \ + __assoc(intel_crtc_state, p), \ + __assoc(intel_digital_port, p), \ + __assoc(intel_dp, p), \ + __assoc(intel_encoder, p), \ + __assoc(intel_hdmi, p)) +#endif /* __INTEL_DISPLAY_TYPES_H__ */
drivers/gpu/drm/i915/display/intel_hdcp.c +124 -126
729 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/4 drm/i915/hdcp: require monotonically increasing seq_num_v
In reply to Sasha LevinFrom: Jani Nikula <[email protected]>
[ Upstream commit db9e64c983dcb07ff256bd455f258c44aa530ff8 ]
The HDCP 2.2 specification requires the seq_num_v to be monotonically increasing, and repeated seq_num_v needs to be treated as an integrity failure. Make it so.
For the first message, seq_num_v must be zero, and is already checked. We can only check for less-than-or-equal for the subsequent messages, where hdcp2_encrypted is true.
Discovered using AI-assisted static analysis confirmed by Intel Product Security.
--- drivers/gpu/drm/i915/display/intel_hdcp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_hdcp.c +4 -3
@@ -1654,9 +1654,10 @@ int hdcp2_authenticate_repeater_topology(struct intel_connector *connector)return -EINVAL ; } -if (seq_num_v < hdcp->seq_num_v) { -/* Roll over of the seq_num_v from repeater. Reauthenticate. */ -drm_dbg_kms (display->drm,"Seq_num_v roll over.\n" ); +if (hdcp->hdcp2_encrypted && seq_num_v <= hdcp->seq_num_v) { +/* Reauthenticate on Seq_num_v repeat or rollover */ +drm_dbg_kms (display->drm,"Seq_num_v %s\n" , + seq_num_v == hdcp->seq_num_v ?"repeat" :"rollover" );return -EINVAL ; }
Signature · 1 line
2.53.0