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 31CCA29B795; Mon, 17 Aug 2026 15:28:53 +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=1786980534; cv=none; b=bDV86Gm5f9GkoaANnR3mYYbMf6EMsBw3WdSbwFOyRWau/OBtSizVlOYwn+/btAsb7KtVVjDn9+lIgSgjmklv8Gpv1BcThPaWQ/EiSC2fUxtvnF7cy6aQGC4QMddUv7W/8QNgVA9eLh7cCu1CkCrkEjfybweMZnWVjgoNp1Qx+RM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786980534; c=relaxed/simple; bh=fVhiMjgfWzYctvYNIyeEwGgmi7jNNCQRkbcmuzNemTU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LgJJxjfwP8cn+LK6r5+4i3J48IeX65ezEjIKXlzRa8hiE0kxWDJOxaLJaEG/q+Gk5eMR3/yLWNKA77FUT6wvIC6OQCW69bqyTnL1i7HOriIbY3xXNiL+QvavvrjL9ifX6h1ZZsz9M2AC0urqZtRDs398+njdsDjd0kjjmPFGdPU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xKKYQpBd; 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="xKKYQpBd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D3FE1F000E9; Mon, 17 Aug 2026 15:28:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786980533; bh=1lKElwSkZ31ND4Vpx21KlHDLWNdLJNkDk9YJvicdB4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=xKKYQpBdowQJQjIOC2RFKZ9CxMiiLzdDu/xv8LIaDE0QQ6vngOz1NsZUNvHfaZ6GU Wzq/jDrYd/7YzC5ZanbT7lgcAIZi5wofHb9Jj9Lz9YOh0jAMMwfEOrnXxrcCZKNnzJ xL3IDorGP4yGa372HQObgI2cf3u4p633Z6AIwcXk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Bryam Vargas , Mika Westerberg Subject: [PATCH 6.1 605/609] thunderbolt: Bound the DROM dual link port number before indexing sw->ports Date: Mon, 17 Aug 2026 15:35:01 +0200 Message-ID: <20260817132603.871608035@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132543.039278408@linuxfoundation.org> References: <20260817132543.039278408@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bryam Vargas commit d6764992f17b23d91ff93ce905ab53c2aa7191f0 upstream. tb_drom_parse_entry_port() validates the device-supplied header->index against sw->config.max_port_number before indexing sw->ports[], but the sibling field entry->dual_link_port_nr -- a 6-bit value also read from the DROM -- indexes the same array with no such check. A malicious or malformed Thunderbolt device can set dual_link_port_nr beyond the allocated sw->ports[] (max_port_number + 1 entries), producing an out-of-bounds tb_port pointer that is stored and later dereferenced. Reject a port entry whose dual_link_port_nr exceeds max_port_number, the same bound already applied to header->index. Fixes: cd22e73bdf5e ("thunderbolt: Read port configuration from eeprom.") Cc: stable@vger.kernel.org Signed-off-by: Bryam Vargas Signed-off-by: Mika Westerberg Signed-off-by: Greg Kroah-Hartman --- drivers/thunderbolt/eeprom.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/thunderbolt/eeprom.c +++ b/drivers/thunderbolt/eeprom.c @@ -392,9 +392,16 @@ static int tb_drom_parse_entry_port(stru return -EIO; } port->link_nr = entry->link_nr; - if (entry->has_dual_link_port) + if (entry->has_dual_link_port) { + if (entry->dual_link_port_nr > sw->config.max_port_number) { + tb_sw_warn(sw, + "port entry has invalid dual link port number %u\n", + entry->dual_link_port_nr); + return -EIO; + } port->dual_link_port = &port->sw->ports[entry->dual_link_port_nr]; + } } return 0; }