Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/i915/bios: false VBT match in
  pnpid_displayid_get_panel_type()
--

commit b621730b3ac12390341a723bfb91f30971b56f98
Author: Ville Syrjälä <[email protected]>

drm/i915/bios: Attempt to match the VBT PnP ID against DisplayID first

This commit attempts to match the VBT PnP ID against the DisplayID product ID
block before falling back to the base EDID vendor/product ID.

> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c 
> b/drivers/gpu/drm/i915/display/intel_bios.c
> index 7b6a6f8c3cf19..8fbabf2e8b6f8 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
[ ... ]
> @@ -732,6 +727,48 @@ static int pnpid_get_panel_type(struct intel_display 
> *display,
>       return best;
>  }
>  
> +static int pnpid_edid_get_panel_type(struct intel_display *display,
> +                                  const struct intel_bios_encoder_data 
> *devdata,
> +                                  const struct drm_edid *drm_edid, bool 
> use_fallback)
> +{
> +     struct drm_edid_product_id product_id;
> +
> +     if (!drm_edid)
> +             return -1;
> +
> +     drm_edid_get_product_id(drm_edid, &product_id);
> +
> +     return pnpid_get_panel_type(display, &product_id, "EDID");
> +}
> +
> +static int pnpid_displayid_get_panel_type(struct intel_display *display,
> +                                       const struct intel_bios_encoder_data 
> *devdata,
> +                                       const struct drm_edid *drm_edid, bool 
> use_fallback)
> +{
> +     struct drm_displayid_product_id displayid_id;
> +     struct drm_edid_product_id product_id;
> +
> +     if (!drm_edid)
> +             return -1;
> +
> +     drm_displayid_get_product_id(drm_edid, &displayid_id);
> +
> +     /*
> +      * Only the first two bytes of the OUI get
> +      * smashed into the old EISA/PNPID field, and
> +      * that gets matched against what's in the VBT.
> +      */
> +     product_id.manufacturer_name =
> +             cpu_to_be16((displayid_id.vendor_id[0] << 8) |
> +                         displayid_id.vendor_id[1]);
> +     product_id.product_code = displayid_id.product_code;
> +     product_id.serial_number = displayid_id.serial_number;
> +     product_id.week_of_manufacture = displayid_id.week_of_manufacture;
> +     product_id.year_of_manufacture = displayid_id.year_of_manufacture;
> +
> +     return pnpid_get_panel_type(display, &product_id, "DisplayID");
> +}

[Severity: High]
Can pnpid_displayid_get_panel_type() falsely match an unpopulated VBT PnP ID
entry when the EDID has no DisplayID Product ID block?

drm_displayid_get_product_id() zeroes displayid_id up front and leaves it
zero-filled if no DisplayID Product ID block is present. Passing the resulting
all-zero product_id into pnpid_get_panel_type() will match the first unused
(all-zero) slot among the 16 entries in BDB_LFP_DATA, causing get_panel_type()
to select that unpopulated VBT panel index via PANEL_TYPE_PNPID_DISPLAYID
instead of falling back to PANEL_TYPE_PNPID_EDID.

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=2

Reply via email to