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 69EB23BB112; Fri, 9 Oct 2026 14:39:50 +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=1791556791; cv=none; b=mdS2FmPzbCWsBKMLBIgUoeH8aH1UEQSJdzNtv38RKrsnHihpRw8oIn3IQIcNKv7B/2dEq2D23w3ZTvGk2aNSmiVEk7KAiBSkFlrNdiec7AM1bM634BXFPy3HHizUpp7U+9yrmmYYSAAkuLjZBUjU9BXgvv/Li2CvVFUqGc3SsYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791556791; c=relaxed/simple; bh=Cj2hGNhWqNhtV7JPk0h9Wso8dCpdaS8KtVzvut8/0wo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AtfJoBN8ZEOh5XvcwfHCMa+g2QgfKBBHWNvJe+OO1exNPWDJBveteragiMXrfDDBaOzyBVOunxFMQC1MF1NTORJuBMV+9VzTYSgn0C8V/eMPnXv3/hAAZeshckv3oIV41XiFiASfGBezScF3ihR0P6f/xSXmoTOIz2yinw+ZL3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=F1qXOBqa; 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="F1qXOBqa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E0881F000FF; Fri, 9 Oct 2026 14:39:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791556790; bh=ngqij+MbZMIPEOQHMLY5NULzZ5ds/T/bb7EOTQ2anOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F1qXOBqaOA5+dvXZdA+SoRBp5YQ8GjvHMAXJpwFMTPz93piIFGNnYmjdbvbYHVWXC 07Ds8ymoIadB8vS5s6z0K7hTJib3oUN30ac9lkErlmRYrd5qQzgLAQAjn9vZ1PSFFA S0CLPxulEZ/frcj19yyUi7L0CMGWuQF+cf/eNOoc= 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.18 293/403] thunderbolt: Reject oversized XDomain properties responses Date: Fri, 9 Oct 2026 16:10:54 +0200 Message-ID: <20261009140959.056025654@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261009140952.119038291@linuxfoundation.org> References: <20261009140952.119038291@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: 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;