From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F6CD606A325 for ; Mon, 30 Nov 2026 22:57:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=GitBv59I Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 067CE10F530; Mon, 30 Nov 2026 22:57:14 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3DA4010F52D for ; Mon, 30 Nov 2026 22:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796079428; x=1827615428; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RsH7mi3+SkCpO0cuWm/P8C9K7egdQphM50H3zlcm8Qg=; b=GitBv59IJXj74Ue7YQnJ1w3ipD+fjE2FVP5ykF8W1P1JMQh1Bxgq2nAE 7PyUfCiMNMxSCtvjBBPvMEvznc1tgtB8pE3RUHdKv+2KiIiRQ06LrWGwa uBysSfDNztud8qQJYfWAEt48+GjBpOM0lutImAxpFwmlbPtDO7STNljAG A6+rkaZqSSeT2IjdgtpnbF5Hh37giUYjiQILRn/2fvMlVx8xvtfDOlWeU hLNPJdAAHcnYWxtlxDW1AJnOIsrxpkj5iD3vjVS4eatniz6xbItCxY+Dk FEAvZl4EexJ8YfR0EeljaYdPp8+TpN5T036smrZlnUYcdnodvvU1LcGhW w==; X-CSE-ConnectionGUID: Jk9A5kb/SnuSo8V5GNPCBQ== X-CSE-MsgGUID: /c1pmsGJQYy+G7cy9HEXfQ== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4837311" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4837311" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 14:56:58 -0800 X-CSE-ConnectionGUID: V9aV26B4QPSJt6CmdFnu4w== X-CSE-MsgGUID: 8SXgss4vRRmVMnBdF8zTeg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13296616" Received: from dut4599nvls.fm.intel.com ([10.80.95.137]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 14:56:58 -0800 From: Stuart Summers To: Cc: intel-xe@lists.freedesktop.org, rodrigo.vivi@intel.com, matthew.d.roper@intel.com, gustavo.sousa@intel.com, Stuart Summers Subject: [PATCH 2/8] drm/xe/configfs: Fix out-of-bounds read in parse_wa_bb_lines() Date: Mon, 30 Nov 2026 22:56:57 +0000 Message-ID: <20261130225655.402159-12-stuart.summers@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130225655.402159-10-stuart.summers@intel.com> References: <20261130225655.402159-10-stuart.summers@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 Reviewed-by: Rodrigo Vivi --- 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 43bef8740474..0937a33ef8a4 100644 --- a/drivers/gpu/drm/xe/xe_configfs.c +++ b/drivers/gpu/drm/xe/xe_configfs.c @@ -855,7 +855,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