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 2F0804D7D30; Tue, 13 Oct 2026 12:42:27 +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=1791895348; cv=none; b=WkfAI8a36sqHrf/meDxUi915x8ArKMoBRoOB33O4v3dZHQgyqV93vIt/Zq0BRbUKGfwIYmkA4ae8jCIplvYLsRN2QIAS7iaWSxM7u7IwNkU7kynEl8FI2iWlrJHDgwMWStpwrLXI6HrS6dmR+Z6r6FM05ifqYNNmQ+NsrkqR2qE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791895348; c=relaxed/simple; bh=S40OXtrvHo5NJYgGwFqrzBeKa0ReNdbK7jcMzgCp5+w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OqIw0ClCWQddvZFofUfe8r7fZovLkfSQELhvvrhpZWfuLvAO6DsNlm94J+FnJs7GYeqBPMQxaTnnwrE+cGKABv8SJ+pGsv8thdwwerKNUMOzlmg0U0v3xMa5F+TfQyXy0zon3H5/ygKJgcgDac8fImmGhrEFE4jnJ6y/tggAhxQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=p1YFnmaD; 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="p1YFnmaD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8137E1F000FF; Tue, 13 Oct 2026 12:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791895347; bh=7k5LpnOZqUPiGcE1RhSHaIn4lQDpP1QTX8EZOKMlfUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=p1YFnmaDmVAtcoF/VkfIl7RIrkJo0Ag8szvm5S63AC+LBYs+QmzGwfAb7rzwatavF cr54d1fIEGgQGovu3lAH/U+TLrZsOQoO/XyojsWsv0YDjuNh3LGiEtdWZK4KoHPI5C PtUPz53b0n1Ge3IEjj8wx2b8kzpL0ow4J97ad1Ps= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daehyeon Ko <4ncienth@gmail.com>, Mika Westerberg Subject: [PATCH 6.12 227/497] thunderbolt: Reject oversized XDomain properties responses Date: Tue, 13 Oct 2026 13:36:34 +0200 Message-ID: <20261013112913.282297986@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daehyeon Ko <4ncienth@gmail.com> commit 80756e263846ab694984e749e8c626897331438f upstream. tb_xdp_properties_request() allocates room for 45 data dwords in its 252-byte response buffer. The XDomain length field is six bits wide, however, and a malicious peer can set it to 63. After the fixed response fields are subtracted, the driver treats this as 48 data dwords. Commit 322e93448d90 ("thunderbolt: Clamp XDomain response data copy to allocation size") only bounds the copy against data_len. If data_len is at least 48, memcpy() reads 192 bytes from the 180-byte res->data array, causing a 12-byte heap out-of-bounds read. Commit 4db2bd2ed478 ("thunderbolt: Limit XDomain response copy to actual frame size") limits the earlier copy but does not constrain this header-derived length. Reject response data lengths that exceed the allocated source buffer before copying them into the assembled property block. Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Daehyeon Ko <4ncienth@gmail.com> Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/xdomain.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/thunderbolt/xdomain.c +++ b/drivers/thunderbolt/xdomain.c @@ -377,6 +377,10 @@ static int tb_xdp_properties_request(str len += sizeof(res->hdr.xd_hdr) / 4; len -= sizeof(*res) / 4; + if (len > TB_XDP_PROPERTIES_MAX_DATA_LENGTH) { + ret = -EINVAL; + goto err; + } if (res->offset != req.offset) { ret = -EINVAL;