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 3C570606A31A for ; Mon, 30 Nov 2026 23:25:35 +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=V+dNIZb8 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F2A1710F55C; Mon, 30 Nov 2026 23:25:29 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2185D10E295 for ; Mon, 30 Nov 2026 23:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796081086; x=1827617086; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RsH7mi3+SkCpO0cuWm/P8C9K7egdQphM50H3zlcm8Qg=; b=V+dNIZb8wuW625QfMyoSkNO6RX+LOtM6XOdEiFHKWneqjm4UJ8oQytRP ieU44+KdbA1wWk/xRFIy76aCAzS90TqANPiG/Jib9j7s1eXXAmhTAaDj/ HDHWGaCFnE9+oDOCLcrWjhuTTxsfpGzX5sdT1wG7Jvk57gEbzcmgG2Krr UEMOEolZ0Quc3erIFjiQfH4TlkUD9bzxMlga83AEYDUFTP2w3MHYqy2Ew vPcJmYjAQ1hAfuniPyIFu922pY0dGuSbuHQ1hT5kJunJrJHBkU3e0N2P3 xHF6ug+8utzWw23S9g1hR8G1FLPDVHFi22SHKw6AYMGV42S2m8LctfFpF A==; X-CSE-ConnectionGUID: MXhabg61SWGJ0pYqCVF2Rw== X-CSE-MsgGUID: j5OvZWWWQTq0/odf+jPHGA== X-IronPort-AV: E=McAfee;i="6800,10657,11982"; a="4935706" X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="4935706" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2026 15:24:41 -0800 X-CSE-ConnectionGUID: P4UUByh5RfiQeMKcBf/A3w== X-CSE-MsgGUID: U5oseXFMTb2Mlul3ljDR/w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,243,1787036400"; d="scan'208";a="13562121" 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 15:24:40 -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 23:24:40 +0000 Message-ID: <20261130232438.584409-12-stuart.summers@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261130232438.584409-10-stuart.summers@intel.com> References: <20261130232438.584409-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