From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A37DB357A20; Wed, 8 Apr 2026 18:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775674736; cv=none; b=n5RHGJwKUqnOGn78q28UEGWRgoFziUMS+80ejRP4VNnB/OzRcbiSlMdxalbv1SkXh2FlsZr/bvj+hygoWw7xljUlTlKswjAGVd+5arrup+QygYJIkcrmwRwXjCnQsffszmg06C04elLh+myNxhc3f9RvsMU3nui4k6YkYHF2XIY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775674736; c=relaxed/simple; bh=cVhlNt73l3L2a4dRRzuv+auuNx/of0Q2NV8fePtDYds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gs0D/WOqjWENEqWCG3RKps721sXXK4VDsfO2NBfb91fhw+zWOEYOXVhC/D+31DyFVwGIlufGW0XMshR73HKif+gQlKlb1Yh0At+ILS4QaoDF4zf5XZStA+NSGgjBZkUtLTsygRRC/yBg93oeJBK5F3KozE2JrapDkwUCp0U/CI8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QVn8mf3D; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QVn8mf3D" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38DD2C19421; Wed, 8 Apr 2026 18:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1775674736; bh=cVhlNt73l3L2a4dRRzuv+auuNx/of0Q2NV8fePtDYds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QVn8mf3D5YOG4pzh3n0P4U3CT3K7M1oK9Q9ZdYshhY7i2zEmdh4XmjH+r8a8HQTzV jj+WJRlUKZJzWjl+oorWXDf74/pd0+g+mX4e290qc8D3VDcNgrXrTrh6Wn4ageYCC2 UuMpeku28uUfR0WPt4ZrpAKy93miLRzHIhVtLWvg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, hkbinbin , Paul Menzel , Luiz Augusto von Dentz Subject: [PATCH 6.19 181/311] Bluetooth: hci_sync: fix stack buffer overflow in hci_le_big_create_sync Date: Wed, 8 Apr 2026 20:03:01 +0200 Message-ID: <20260408175946.169353332@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260408175939.393281918@linuxfoundation.org> References: <20260408175939.393281918@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: hkbinbin commit bc39a094730ce062fa034a529c93147c096cb488 upstream. hci_le_big_create_sync() uses DEFINE_FLEX to allocate a struct hci_cp_le_big_create_sync on the stack with room for 0x11 (17) BIS entries. However, conn->num_bis can hold up to HCI_MAX_ISO_BIS (31) entries — validated against ISO_MAX_NUM_BIS (0x1f) in the caller hci_conn_big_create_sync(). When conn->num_bis is between 18 and 31, the memcpy that copies conn->bis into cp->bis writes up to 14 bytes past the stack buffer, corrupting adjacent stack memory. This is trivially reproducible: binding an ISO socket with bc_num_bis = ISO_MAX_NUM_BIS (31) and calling listen() will eventually trigger hci_le_big_create_sync() from the HCI command sync worker, causing a KASAN-detectable stack-out-of-bounds write: BUG: KASAN: stack-out-of-bounds in hci_le_big_create_sync+0x256/0x3b0 Write of size 31 at addr ffffc90000487b48 by task kworker/u9:0/71 Fix this by changing the DEFINE_FLEX count from the incorrect 0x11 to HCI_MAX_ISO_BIS, which matches the maximum number of BIS entries that conn->bis can actually carry. Fixes: 42ecf1947135 ("Bluetooth: ISO: Do not emit LE BIG Create Sync if previous is pending") Cc: stable@vger.kernel.org Signed-off-by: hkbinbin Reviewed-by: Paul Menzel Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- net/bluetooth/hci_sync.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -7210,7 +7210,8 @@ static void create_big_complete(struct h static int hci_le_big_create_sync(struct hci_dev *hdev, void *data) { - DEFINE_FLEX(struct hci_cp_le_big_create_sync, cp, bis, num_bis, 0x11); + DEFINE_FLEX(struct hci_cp_le_big_create_sync, cp, bis, num_bis, + HCI_MAX_ISO_BIS); struct hci_conn *conn = data; struct bt_iso_qos *qos = &conn->iso_qos; int err;