From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384385; b=JiFzrNSfxyZmbNMuhuutu55e8chvHyQbCm1vzmkb3nnGzl35i5f6Y8BF+rMP5yiZ7qvB UbXGIkMXNlDdVYNGl1z4zw/JLlt0f4RVlbUcdBzx/a310UaMrDB6ZAmYMixm5o+bgqF09 cCluWDTeg3n3iqNydKB/NxRM4Zto3y+K8YiGGajBeFNODwgozmcFLYkpTvqcATN3nmwYc jOEzVzwxFhz5vCBvPYNyhtmmpsSHo/nxbgcKNbmN4s70Ib/V8sakncDgwlbh9ynXxthCt WhzI1Vuoc78Cp9xOMCUuOdt0PeGlE3IucBk3Gm5GXj1lKHVqmxkTXun7ORYlHrAMfQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384385; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=Re7rPyVr/leY8TLnSmql4kxqBcLOB9u1gS2MmsDmB9U=; b=lVn3X7FXVMDj5VIx5sB0eIgRq+rDZCPDBS6b6NREcOIkATObpPjp2oM/FNiUrzLVOeYT +fTKxeJB4kKh+r9So5ozNERY9695a34j8IT/3n6bQnmnqvZCxP6B33EWpwk4Frkr7aWMX IYxjcrYqykquFKXAF+TvwSzKxOvW78+D+ZUB/+M5ErE0fzpufX7umtzwVRHRYtSpRKNSM EHIyD5Nfsg92GwXEYutBhLgKhtZVR1XoY2l7BojtATcgOM7sNczq91dNFOhD6r8UWKtrz WIV59FOE5gSZNB/Q3RUL2A65OPU98HClzEdoyuai1Sql7h2EIRRYjFJx86uqDtF0WxA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=AEd9NF5e; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A195B606A322; Fri, 4 Dec 2026 11:39:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=AEd9NF5e Received: by smtp.kernel.org (Postfix) with ESMTPSA id B747C1F000C2; Fri, 4 Dec 2026 11:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384385; bh=Re7rPyVr/leY8TLnSmql4kxqBcLOB9u1gS2MmsDmB9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AEd9NF5ecgqUgxL/yzxf6tPp9VxN01K5bNeN1oCsGCzBDiBTMlkCjRPOozPWKx2a1 BYqD+CKT1+DvMSrOM+qsnXq/BhRv22Z3tdp0qgBMFn5gd6RTivEk2YUxktoNSpnE9l rVIGm4ltvcdzKqetSEl59ekCfVLbqfiMRjEDn38w= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yifan Zhang , Luiz Augusto von Dentz , Sasha Levin Subject: [PATCH 6.6 0127/1167] Bluetooth: validate retained LE Set CIG Parameters command length Date: Fri, 4 Dec 2026 18:52:34 +0900 Message-ID: <20261204100705.392890175@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yifan Zhang [ Upstream commit ed4d302af778b9e2ead28134a2196c09a4ad248a ] hci_cc_le_set_cig_params() validates the controller response but not the parameters of the previously sent command. A short command can claim a large num_cis without containing the corresponding cis[] array. A complete successful response then makes the handler read beyond the command skb while looking up each CIS ID. KASAN reports: BUG: KASAN: slab-out-of-bounds in hci_cc_le_set_cig_params Read of size 1 hci_cc_le_set_cig_params hci_cmd_complete_evt hci_event_packet Obtain the retained parameter length and require both the fixed header and the complete CIS array before using the command data. The reproducer no longer triggers a KASAN report with this change. Fixes: 71e9588435c3 ("Bluetooth: ISO: use correct CIS order in Set CIG Parameters event") Closes: https://lore.kernel.org/linux-bluetooth/179317463153.87610.8996555110609321376@stu.pku.edu.cn/ Signed-off-by: Yifan Zhang Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- net/bluetooth/hci_event.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index e8b504959bd5f..2407ff299f8e9 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -3809,13 +3809,16 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data, struct hci_conn *conn; u8 status = rp->status; bool pending = false; + size_t len; int i; bt_dev_dbg(hdev, "status 0x%2.2x", rp->status); - cp = hci_sent_cmd_data(hdev, HCI_OP_LE_SET_CIG_PARAMS); + cp = hci_sent_cmd_data_len(hdev, HCI_OP_LE_SET_CIG_PARAMS, &len); if (!rp->status && - (!cp || rp->num_handles != cp->num_cis || + (!cp || len < sizeof(*cp) || + len < struct_size(cp, cis, cp->num_cis) || + rp->num_handles != cp->num_cis || rp->cig_id != cp->cig_id || skb->len < array_size(rp->num_handles, sizeof(*rp->handle)))) { bt_dev_err(hdev, "unexpected Set CIG Parameters response data"); -- 2.53.0