From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F5512D8378; Sun, 7 Jun 2026 10:50:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780829444; cv=none; b=CGq81hZIcsZmoLHz0wRT6NItD8Lgil2n6iUyeDqv9gkqm5j51RuafgsWmN+eC6h2vdZH2TBVorb5ZGZXawRGFx4ROYz9HoOOdQsf0EajbHMnZIAnT2ADmxFNifG0MZqJwDimYqDXtLsmCW7GUcxojrzprl+JcDBqLfvue/Frvpo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780829444; c=relaxed/simple; bh=pEdvXqFfL8nBL0ggNvC4w1TQaNos2pqW9nol8C1W77k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=od1mib4t8tfyYNeArV14zLm/EcrBzirQ8APr1OO6mFoL2faaaS2JnDOGD5Uo/57BlAKOB9pcVhSakRBXwAoN1C6UAPfN/OUZ+1sAHI+F90TE0TT1/C4hVLEJ4q0lg1KRzhRqitsBblKYsr4wEXBVFQcicdsL9Vv5YyV2yQRV6EU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xrDLLJYW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xrDLLJYW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4DF21F00893; Sun, 7 Jun 2026 10:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780829443; bh=SARjY/jo74MDWr/Yn/ITP/9voX936nX9p7938Eq5EfQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xrDLLJYWMgUiXSjIBL1//Ps63mhZ+3JhiPsd3U09hflrhY8mbxPU4oWp1MrBxRDDq T1gnSMTf5PYHFan+9FJFyUImVYMC7uqhdFuj/q5TBp2muY3mK+jv32OgPTQUfYQMj7 qSuyfx6SUgtOjoSZLmxqN7zC8XZ3Qicgr98tWyz4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Michael Bommarito , Mika Westerberg Subject: [PATCH 6.18 248/315] thunderbolt: property: Reject u32 wrap in tb_property_entry_valid() Date: Sun, 7 Jun 2026 12:00:35 +0200 Message-ID: <20260607095736.672184981@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260607095727.528828913@linuxfoundation.org> References: <20260607095727.528828913@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michael Bommarito commit 01deda0152066c6c955f0619114ea6afa070aaec upstream. entry->value is u32 and entry->length is u16; the sum is performed in u32 and wraps. A malicious XDomain peer can pick value = 0xffffff00, length = 0x100 so the sum 0x100000000 wraps to 0 and passes the > block_len check. tb_property_parse() then passes entry->value to parse_dwdata() as a dword offset into the property block, reading attacker-directed memory far past the allocation. For TEXT-typed entries with the "deviceid" or "vendorid" keys this lands in xd->device_name / xd->vendor_name and is readable back via the per-XDomain device_name / vendor_name sysfs attributes; the leak is NUL-bounded (kstrdup() stops at the first zero byte) and untargeted (the attacker picks a delta, not an absolute address). DATA-typed entries are parsed into property->value.data but not generically surfaced to userspace. Use check_add_overflow() so a wrapped sum is rejected. Fixes: cdae7c07e3e3 ("thunderbolt: Add support for XDomain properties") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-6 Assisted-by: Codex:gpt-5-4 Signed-off-by: Michael Bommarito Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/property.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/thunderbolt/property.c +++ b/drivers/thunderbolt/property.c @@ -8,6 +8,7 @@ */ #include +#include #include #include #include @@ -52,13 +53,16 @@ static inline void format_dwdata(void *d static bool tb_property_entry_valid(const struct tb_property_entry *entry, size_t block_len) { + u32 end; + switch (entry->type) { case TB_PROPERTY_TYPE_DIRECTORY: case TB_PROPERTY_TYPE_DATA: case TB_PROPERTY_TYPE_TEXT: if (entry->length > block_len) return false; - if (entry->value + entry->length > block_len) + if (check_add_overflow(entry->value, entry->length, &end) || + end > block_len) return false; break;