Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Stuart Summers <stuart.summers@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.brost@intel.com>,
	<umesh.nerlige.ramappa@intel.com>, <gustavo.sousa@intel.com>,
	<matthew.d.roper@intel.com>, <daniele.ceraolospurio@intel.com>,
	<shuicheng.lin@intel.com>
Subject: Re: [PATCH 02/15] drm/xe/configfs: Fix out-of-bounds read in parse_wa_bb_lines()
Date: Tue, 13 Oct 2026 15:08:00 -0400	[thread overview]
Message-ID: <as6BkCZ3jUpkpTd6@intel.com> (raw)
In-Reply-To: <20261005220636.602826-19-stuart.summers@intel.com>

On Mon, Oct 05, 2026 at 10:06:38PM +0000, Stuart Summers wrote:
> The outer loop advances the cursor unconditionally at the end of each
> iteration. When the last token of a line is terminated by the NUL rather
> than by whitespace, e.g. "echo -n 'rcs cmd 1'", the cursor is already on
> the NUL and the increment steps past the end of the buffer, so the loop
> condition reads out of bounds. The leading strspn(p, " \t\n") already
> skips the line separators, and every iteration consumes at least the
> engine class token, so dropping the increment keeps the loop making
> progress.
> 
> Fixes: 39ac06f70062 ("drm/xe/configfs: Add post context restore bb")
> 
> Signed-off-by: Stuart Summers <stuart.summers@intel.com>
> Assisted-by: LLM

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_configfs.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index e1cf5af958bc..1c7a096aa046 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -820,7 +820,11 @@ static ssize_t parse_wa_bb_lines(const char *lines,
>  	ssize_t dwords = 0, ret;
>  	const char *p;
>  
> -	for (p = lines; *p; p++) {
> +	/*
> +	 * Each iteration consumes at least the engine class token if it doesn't
> +	 * error out, so the loop always makes progress without advancing @p.
> +	 */
> +	for (p = lines; *p;) {
>  		const struct engine_info *info = NULL;
>  		u32 val, val2;
>  
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-10-13 19:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 22:06 [PATCH 00/15] Add new debug infrastructure for configfs Stuart Summers
2026-10-05 22:06 ` [PATCH 01/15] drm/xe: Guard configfs attribute reads in getters Stuart Summers
2026-10-05 22:06 ` [PATCH 02/15] drm/xe/configfs: Fix out-of-bounds read in parse_wa_bb_lines() Stuart Summers
2026-10-13 19:08   ` Rodrigo Vivi [this message]
2026-10-05 22:06 ` [PATCH 03/15] drm/xe/configfs: Copy wa_bb out under the configfs lock Stuart Summers
2026-10-13 19:10   ` Rodrigo Vivi
2026-10-13 20:35     ` Summers, Stuart
2026-10-05 22:06 ` [PATCH 04/15] drm/xe: Invert vram_page_offline configfs attribute Stuart Summers
2026-10-13 19:13   ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 05/15] drm/xe: Make survivability_mode configfs attribute a bitmap Stuart Summers
2026-10-13 19:14   ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 06/15] drm/xe: Sort xe_config_device fields Stuart Summers
2026-10-05 22:06 ` [PATCH 07/15] drm/xe: Split out configfs data structures Stuart Summers
2026-10-05 22:06 ` [PATCH 08/15] drm/xe: Add a new debug focused configfs group Stuart Summers
2026-10-05 22:06 ` [PATCH 09/15] drm/xe: Move debug configfs entries to xe_configfs_debug.c Stuart Summers
2026-10-13 19:16   ` Rodrigo Vivi
2026-10-05 22:06 ` [PATCH 10/15] drm/xe/guc: Add configfs support for guc_log_level Stuart Summers
2026-10-05 22:06 ` [PATCH 11/15] drm/xe/guc: Add support for NPK as a GuC log target Stuart Summers
2026-10-05 22:06 ` [PATCH 12/15] drm/xe: Add infrastructure for debug configfs parameters Stuart Summers
2026-10-05 22:06 ` [PATCH 13/15] drm/xe: Migrate existing debug configfs entries to params infrastructure Stuart Summers
2026-10-05 22:06 ` [PATCH 14/15] drm/xe: Taint kernel when debug configfs parameters are set Stuart Summers
2026-10-05 22:06 ` [PATCH 15/15] drm/xe: Add enable_media module parameter Stuart Summers
2026-10-05 22:13 ` ✗ CI.checkpatch: warning for Add new debug infrastructure for configfs (rev10) Patchwork
2026-10-05 22:15 ` ✓ CI.KUnit: success " Patchwork
2026-10-05 23:17 ` ✓ Xe.CI.BAT: " Patchwork
2026-10-06  6:22 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-10-07 19:13   ` Summers, Stuart
  -- strict thread matches above, loose matches on Subject: below --
2026-10-05 19:06 [PATCH 00/15] Add new debug infrastructure for configfs Stuart Summers
2026-10-05 19:06 ` [PATCH 02/15] drm/xe/configfs: Fix out-of-bounds read in parse_wa_bb_lines() Stuart Summers

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=as6BkCZ3jUpkpTd6@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=gustavo.sousa@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.brost@intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=shuicheng.lin@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=umesh.nerlige.ramappa@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