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 64A4F1DD873 for ; Fri, 27 Dec 2024 15:07:01 +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=1735312021; cv=none; b=YBsAt2WMoQ3OIqOsm1vmkkjx1Q1FTw74Y3PXNAH/WDpZvMMTGJlwozJQvXfuD98f25oKarNa0pvPPyDEUS7p8HFrE7UZX+zhmUwfJGf1qpDKZierjKHPzu0s4EtzGkbuFYOE9vOmlD0NNFzj005GQMv/bbwpiT/7tfHlLCKx2ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735312021; c=relaxed/simple; bh=8heQyYPHW5ZHt61Yet54OkxsgVFsCHmt+yiftAF1fsg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Zz6x7M6QcxEMxbpUQ8zmdH11+0Q821IlNqlwCQJ9hQ/sI9TlKc5eI6LtwrJ9BHZSSQgy/4+bp3V00dLxfkheEqQdwjDMzbEvzyFDUZDU+SvWQG5kwFJTHEMTR84wRgw1jUw14Vnwc/8O0bWwI0l9QmksqDjXtWqpVGUF58wwqeM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IMYhyJXU; 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="IMYhyJXU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DC39C4CED0; Fri, 27 Dec 2024 15:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735312020; bh=8heQyYPHW5ZHt61Yet54OkxsgVFsCHmt+yiftAF1fsg=; h=From:To:Cc:Subject:Date:Reply-to:From; b=IMYhyJXUrg3P+RwzqFuwVQgDqDBRJs1kUimOKhmcuhxgYpG5n63ahrJSnnqFeICac MedYW/Uy6zRi7a1W5k7uWIkmhFOTEwiCuM7Kvxl6mfjS8Uc8Iau5B3f77pE0NXUmgF J6CL0ajxbpts5FnexgBadvaF3K6anmT+5/ptd0qI= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-56653: Bluetooth: btmtk: avoid UAF in btmtk_process_coredump Date: Fri, 27 Dec 2024 16:06:50 +0100 Message-ID: <2024122749-CVE-2024-56653-bb35@gregkh> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=5215; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=8heQyYPHW5ZHt61Yet54OkxsgVFsCHmt+yiftAF1fsg=; b=owGbwMvMwCRo6H6F97bub03G02pJDOl5hzr189kWfpgn+1NYI+w565G8Aungg4rXjH+3nE5Ln PT1ed+OjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIuzfDgm0uf6bdWPrmgMtm 9w8nvzP0eqbyfmJY0NTa9flgxkk+Vbe0nU+Osa3jaJjvDAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: Bluetooth: btmtk: avoid UAF in btmtk_process_coredump hci_devcd_append may lead to the release of the skb, so it cannot be accessed once it is called. ================================================================== BUG: KASAN: slab-use-after-free in btmtk_process_coredump+0x2a7/0x2d0 [btmtk] Read of size 4 at addr ffff888033cfabb0 by task kworker/0:3/82 CPU: 0 PID: 82 Comm: kworker/0:3 Tainted: G U 6.6.40-lockdep-03464-g1d8b4eb3060e #1 b0b3c1cc0c842735643fb411799d97921d1f688c Hardware name: Google Yaviks_Ufs/Yaviks_Ufs, BIOS Google_Yaviks_Ufs.15217.552.0 05/07/2024 Workqueue: events btusb_rx_work [btusb] Call Trace: dump_stack_lvl+0xfd/0x150 print_report+0x131/0x780 kasan_report+0x177/0x1c0 btmtk_process_coredump+0x2a7/0x2d0 [btmtk 03edd567dd71a65958807c95a65db31d433e1d01] btusb_recv_acl_mtk+0x11c/0x1a0 [btusb 675430d1e87c4f24d0c1f80efe600757a0f32bec] btusb_rx_work+0x9e/0xe0 [btusb 675430d1e87c4f24d0c1f80efe600757a0f32bec] worker_thread+0xe44/0x2cc0 kthread+0x2ff/0x3a0 ret_from_fork+0x51/0x80 ret_from_fork_asm+0x1b/0x30 Allocated by task 82: stack_trace_save+0xdc/0x190 kasan_set_track+0x4e/0x80 __kasan_slab_alloc+0x4e/0x60 kmem_cache_alloc+0x19f/0x360 skb_clone+0x132/0xf70 btusb_recv_acl_mtk+0x104/0x1a0 [btusb] btusb_rx_work+0x9e/0xe0 [btusb] worker_thread+0xe44/0x2cc0 kthread+0x2ff/0x3a0 ret_from_fork+0x51/0x80 ret_from_fork_asm+0x1b/0x30 Freed by task 1733: stack_trace_save+0xdc/0x190 kasan_set_track+0x4e/0x80 kasan_save_free_info+0x28/0xb0 ____kasan_slab_free+0xfd/0x170 kmem_cache_free+0x183/0x3f0 hci_devcd_rx+0x91a/0x2060 [bluetooth] worker_thread+0xe44/0x2cc0 kthread+0x2ff/0x3a0 ret_from_fork+0x51/0x80 ret_from_fork_asm+0x1b/0x30 The buggy address belongs to the object at ffff888033cfab40 which belongs to the cache skbuff_head_cache of size 232 The buggy address is located 112 bytes inside of freed 232-byte region [ffff888033cfab40, ffff888033cfac28) The buggy address belongs to the physical page: page:00000000a174ba93 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x33cfa head:00000000a174ba93 order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x4000000000000840(slab|head|zone=1) page_type: 0xffffffff() raw: 4000000000000840 ffff888100848a00 0000000000000000 0000000000000001 raw: 0000000000000000 0000000080190019 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888033cfaa80: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc ffff888033cfab00: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb >ffff888033cfab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888033cfac00: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc ffff888033cfac80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== Check if we need to call hci_devcd_complete before calling hci_devcd_append. That requires that we check data->cd_info.cnt >= MTK_COREDUMP_NUM instead of data->cd_info.cnt > MTK_COREDUMP_NUM, as we increment data->cd_info.cnt only once the call to hci_devcd_append succeeds. The Linux kernel CVE team has assigned CVE-2024-56653 to this issue. Affected and fixed versions =========================== Issue introduced in 6.6 with commit 0b70151328781a89c89e4cf3fae21fc0e98d869e and fixed in 6.6.67 with commit ecdcaea0e4057171ea4c3783e1cc1c900ad99125 Issue introduced in 6.6 with commit 0b70151328781a89c89e4cf3fae21fc0e98d869e and fixed in 6.12.6 with commit d20ff1d3cb40479789368f502eedb0a00e4161fc Issue introduced in 6.6 with commit 0b70151328781a89c89e4cf3fae21fc0e98d869e and fixed in 6.13-rc3 with commit b548f5e9456c568155499d9ebac675c0d7a296e8 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-56653 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/bluetooth/btmtk.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/ecdcaea0e4057171ea4c3783e1cc1c900ad99125 https://git.kernel.org/stable/c/d20ff1d3cb40479789368f502eedb0a00e4161fc https://git.kernel.org/stable/c/b548f5e9456c568155499d9ebac675c0d7a296e8