public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Lukasz Majczak <lma@semihalf.com>,
	Jose Roberto de Souza <jose.souza@intel.com>,
	Shawn C Lee <shawn.c.lee@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	upstream@semihalf.com, Lukasz Majczak <lma@semihalf.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v1] drm/i915/bdb: Fix version check
Date: Mon, 20 Sep 2021 19:55:33 +0300	[thread overview]
Message-ID: <87y27rtce2.fsf@intel.com> (raw)
In-Reply-To: <20210920141101.194959-1-lma@semihalf.com>

On Mon, 20 Sep 2021, Lukasz Majczak <lma@semihalf.com> wrote:
> With patch "drm/i915/vbt: Fix backlight parsing for VBT 234+"
> the size of bdb_lfp_backlight_data structure has been increased,
> causing if-statement in the parse_lfp_backlight function
> that comapres this structure size to the one retrieved from BDB,
> always to fail for older revisions.
> This patch fixes it by comparing a total size of all fileds from
> the structure (present before the change) with the value gathered from BDB.
> Tested on Chromebook Pixelbook (Nocturne) (reports bdb->version = 221)
>
> Cc: <stable@vger.kernel.org> # 5.4+

Not a review of the patch, I'll leave that to José, but 5.4 is not
right.

The commit is d381baad29b4 ("drm/i915/vbt: Fix backlight parsing for VBT
234+") which was merged in v5.11 and AFAICT has not been backported to
any stable kernel.

So this would be:

Fixes: d381baad29b4 ("drm/i915/vbt: Fix backlight parsing for VBT 234+")
Cc: <stable@vger.kernel.org> # v5.11+

BR,
Jani.




> Tested-by: Lukasz Majczak <lma@semihalf.com>
> Signed-off-by: Lukasz Majczak <lma@semihalf.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c     | 4 +++-
>  drivers/gpu/drm/i915/display/intel_vbt_defs.h | 5 +++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 3c25926092de..052a19b455d1 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -452,7 +452,9 @@ parse_lfp_backlight(struct drm_i915_private *i915,
>  
>  	i915->vbt.backlight.type = INTEL_BACKLIGHT_DISPLAY_DDI;
>  	if (bdb->version >= 191 &&
> -	    get_blocksize(backlight_data) >= sizeof(*backlight_data)) {
> +	    get_blocksize(backlight_data) >= (sizeof(backlight_data->entry_size) +
> +					      sizeof(backlight_data->data) +
> +					      sizeof(backlight_data->level))) {
>  		const struct lfp_backlight_control_method *method;
>  
>  		method = &backlight_data->backlight_control[panel_type];
> diff --git a/drivers/gpu/drm/i915/display/intel_vbt_defs.h b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
> index 330077c2e588..fff456bf8783 100644
> --- a/drivers/gpu/drm/i915/display/intel_vbt_defs.h
> +++ b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
> @@ -814,6 +814,11 @@ struct lfp_brightness_level {
>  	u16 reserved;
>  } __packed;
>  
> +/*
> + * Changing struct bdb_lfp_backlight_data might affect its
> + * size comparation to the value hold in BDB.
> + * (e.g. in parse_lfp_backlight())
> + */
>  struct bdb_lfp_backlight_data {
>  	u8 entry_size;
>  	struct lfp_backlight_data_entry data[16];

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2021-09-20 17:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 14:11 [PATCH v1] drm/i915/bdb: Fix version check Lukasz Majczak
2021-09-20 16:55 ` Jani Nikula [this message]
2021-09-20 20:47 ` Souza, Jose
2021-09-21  9:01   ` Lukasz Majczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y27rtce2.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=jose.souza@intel.com \
    --cc=lma@semihalf.com \
    --cc=shawn.c.lee@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=upstream@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox