From: Jani Nikula <jani.nikula@linux.intel.com>
To: Noah Weinberger <NoahWeinberger2003@proton.me>,
"rodrigo.vivi@intel.com" <rodrigo.vivi@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/i915/bios: validate VBT vswing/preemphasis override table
Date: Wed, 18 Nov 2026 14:44:45 +0200 [thread overview]
Message-ID: <332a02491f1f60617411757a2c9abedc4b637141@intel.com> (raw)
In-Reply-To: <40IXMMqFQJJm26J3saK7hx09nF4FuE3ZJcU6gMIryuxuGC5VENrcgA9q4klryPNSLnMwE64szv7eg4wf__gU8OlgzlL8tw3CmV_78Kc_H14=@proton.me>
On Sun, 08 Nov 2026, Noah Weinberger <NoahWeinberger2003@proton.me> wrote:
> Hello,
>
> Proposed-fix limitation: the patch below does not validate the full
> VBT table extent against the section size. The malformed/short-table
> out-of-bounds case described below remains unresolved by these
> existence and minimum-count checks. This is an incomplete proposal for
> maintainer review; a complete fix still needs section-extent bounds
> validation.
>
> parse_vswing_preemph_override() stores the raw pointer and count fields
> from VBT block 57 without validating that the block actually contains
> the announced table, and allocate_vswing_preemph_override() allocates
> the consumer structures whenever a child device sets use_vbt_vswing -
> even when the block is absent entirely. validate_vspeo() only checks
> that devdata->vspeo is non-NULL and that the port has DP.
>
> Two failure modes follow at DDI buffer-translation time:
> - block absent: tables == NULL, num_columns == 0, so the consumer
> dereferences tables[0] (NULL).
> - block short or malformed: the table walk reads up to
> (5+1)*num_rows*num_columns u32s from a block whose enforced minimum
> size is 2 bytes - with num_columns = 255 that is ~98 KB past a small
> heap allocation, and the values are programmed into PHY registers.
>
> The patch gates the consumer on the table existing with sane counts.
> A complete fix should also validate the table extent against the
> section size, which is not currently plumbed through; happy to rework
> if there is a preferred way to carry the section size.
>
> Affected version/commit: mainline fa4ad798f6f681031775266044ba1b0cf3c670bd (v7.4-rc1, 2026-11-07), drivers/gpu/drm/i915/display/intel_bios.c:2216-2234 (parse), 2654-2676 (allocate), 3874-3923 (validate/consume).
> Introduced in the v7.4 merge window.
>
> This was found during an assisted (AI-supported) static source review of
> mainline fa4ad798f6f681031775266044ba1b0cf3c670bd (v7.4-rc1, 2026-11-07); every code path cited below was re-verified by the
> reporter against that tree. The patch below has NOT been compiled and has
> NOT been runtime tested, and no reproducer was produced - the triggering
> conditions are described above instead. Please treat this as a report for
> verification rather than a battle-tested fix.
>
> Reported-by: Noah Weinberger <noahweinberger2003@proton.me>
Please see [1] on how to report i915 issues.
BR,
Jani.
[1] https://drm.pages.freedesktop.org/intel-docs/how-to-file-i915-bugs.html
> ---
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 7b6a6f8..d99a675 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -2657,7 +2657,8 @@ static void allocate_vswing_preemph_override(struct intel_bios_encoder_data *dev
> union intel_ddi_buf_trans_entry *entries;
> struct intel_ddi_buf_trans *vspeo;
>
> - if (!intel_bios_encoder_requests_vspeo(devdata))
> + if (!intel_bios_encoder_requests_vspeo(devdata) ||
> + !devdata->display->vbt.vspeo.tables)
> return;
>
> vspeo = kzalloc_obj(*vspeo);
> @@ -3876,6 +3877,8 @@ validate_vspeo(const struct intel_bios_encoder_data *devdata, bool has_dp)
> {
> struct intel_ddi_buf_trans *vspeo;
>
> + struct intel_display *display = devdata->display;
> +
> vspeo = devdata->vspeo;
> if (!vspeo)
> return false;
> @@ -3883,5 +3886,10 @@ validate_vspeo(const struct intel_bios_encoder_data *devdata, bool has_dp)
> if (!has_dp)
> return false;
>
> + if (!display->vbt.vspeo.tables ||
> + display->vbt.vspeo.num_columns < 3 ||
> + display->vbt.vspeo.num_tables < 6)
> + return false;
> +
> return true;
> }
>
--
Jani Nikula, Intel
prev parent reply other threads:[~2026-11-18 12:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 22:29 Noah Weinberger
2026-11-18 12:44 ` Jani Nikula [this message]
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=332a02491f1f60617411757a2c9abedc4b637141@intel.com \
--to=jani.nikula@linux.intel.com \
--cc=NoahWeinberger2003@proton.me \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rodrigo.vivi@intel.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
all inboxes | Powered by JetHome®