On Tue, Aug 16, 2022 at 06:37:20PM +0300, Jani Nikula wrote: > Avoid using ports that aren't initialized in case the VBT backlight or > CABC ports have invalid values. This fixes a NULL pointer dereference of > intel_dsi->dsi_hosts[port] in such cases. > > Cc: stable@xxxxxxxxxxxxxxx > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> Would be interesting to figure out which one of those actually fixed the https://gitlab.freedesktop.org/drm/intel/-/issues/6476 issue, this one or next one. Reviewed-by: Stanislav Lisovskiy <stanislav.lisovskiy@xxxxxxxxx> > --- > drivers/gpu/drm/i915/display/icl_dsi.c | 7 +++++++ > drivers/gpu/drm/i915/display/vlv_dsi.c | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/icl_dsi.c b/drivers/gpu/drm/i915/display/icl_dsi.c > index 5dcfa7feffa9..885c74f60366 100644 > --- a/drivers/gpu/drm/i915/display/icl_dsi.c > +++ b/drivers/gpu/drm/i915/display/icl_dsi.c > @@ -2070,7 +2070,14 @@ void icl_dsi_init(struct drm_i915_private *dev_priv) > else > intel_dsi->ports = BIT(port); > > + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports)) > + intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports; > + > intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports; > + > + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports)) > + intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports; > + > intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports; > > for_each_dsi_port(port, intel_dsi->ports) { > diff --git a/drivers/gpu/drm/i915/display/vlv_dsi.c b/drivers/gpu/drm/i915/display/vlv_dsi.c > index b9b1fed99874..35136d26e517 100644 > --- a/drivers/gpu/drm/i915/display/vlv_dsi.c > +++ b/drivers/gpu/drm/i915/display/vlv_dsi.c > @@ -1933,7 +1933,14 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv) > else > intel_dsi->ports = BIT(port); > > + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.bl_ports & ~intel_dsi->ports)) > + intel_connector->panel.vbt.dsi.bl_ports &= intel_dsi->ports; > + > intel_dsi->dcs_backlight_ports = intel_connector->panel.vbt.dsi.bl_ports; > + > + if (drm_WARN_ON(&dev_priv->drm, intel_connector->panel.vbt.dsi.cabc_ports & ~intel_dsi->ports)) > + intel_connector->panel.vbt.dsi.cabc_ports &= intel_dsi->ports; > + > intel_dsi->dcs_cabc_ports = intel_connector->panel.vbt.dsi.cabc_ports; > > /* Create a DSI host (and a device) for each port. */ > -- > 2.34.1 >