FAILED: patch "[PATCH] drm/i915/opregion: check port number bounds for SWSCI display" failed to apply to 4.14-stable tree
[email protected]
maintainerThe patch below does not apply to the 4.14-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]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 24a644ebbfd3b13cda702f98907f9dd123e34bf9 Mon Sep 17 00:00:00 2001
From: Jani Nikula <[email protected]>
Date: Thu, 10 Feb 2022 12:36:42 +0200
Subject: [PATCH] drm/i915/opregion: check port number bounds for SWSCI display
power state
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The mapping from enum port to whatever port numbering scheme is used by the SWSCI Display Power State Notification is odd, and the memory of it has faded. In any case, the parameter only has space for ports numbered [0..4], and UBSAN reports bit shift beyond it when the platform has port F or more.
Since the SWSCI functionality is supposed to be obsolete for new platforms (i.e. ones that might have port F or more), just bail out early if the mapped and mangled port number is beyond what the Display Power State Notification can support.
drivers/gpu/drm/i915/display/intel_opregion.c +15 -0
@@ -363,6 +363,21 @@ int intel_opregion_notify_encoder(struct intel_encoder *intel_encoder, port++; } +/* +* The port numbering and mapping here is bizarre. The now-obsolete +* swsci spec supports ports numbered [0..4]. Port E is handled as a +* special case, but port F and beyond are not. The functionality is +* supposed to be obsolete for new platforms. Just bail out if the port +* number is out of bounds after mapping. +*/ +if (port >4 ) { +drm_dbg_kms (&dev_priv->drm, +"[ENCODER:%d:%s] port %c (index %u) out of bounds for display power state notification\n" , + intel_encoder->base.base.id, intel_encoder->base.name, +port_name (intel_encoder->port), port); +return -EINVAL ; + } +if (!enable) parm |=4 <<8 ;