Vulnerability · Published Dec 27, 2024 · Assigned by Linux
CVE-2024-53166block, bfq: fix bfqq uaf in bfq_limit_depth()
High 7.8
In plain English
A high-severity use-after-free in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 17% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
In the Linux kernel, the following vulnerability has been resolved: block, bfq: fix bfqq uaf in bfq_limit_depth() Set new allocated bfqq to bic or remove freed bfqq from bic are both protected by bfqd->lock, however bfq_limit_depth() is deferencing bfqq from bic without the lock, this can lead to UAF if the io_context is shared by multiple tasks. For example, test bfq with io_uring can trigger following UAF in v6.6: ================================================================== BUG: KASAN: slab-use-after-free in bfqq_group+0x15/0x50 Call Trace: <TASK> dump_stack_lvl+0x47/0x80 print_address_description.constprop.0+0x66/0x300 print_report+0x3e/0x70 kasan_report+0xb4/0xf0 bfqq_group+0x15/0x50 bfqq_request_over_limit+0x130/0x9a0 bfq_limit_depth+0x1b5/0x480 __blk_mq_alloc_requests+0x2b5/0xa00 blk_mq_get_new_requests+0x11d/0x1d0 blk_mq_submit_bio+0x286/0xb00 submit_bio_noacct_nocheck+0x331/0x400 __block_write_full_folio+0x3d0/0x640 writepage_cb+0x3b/0xc0 write_cache_pages+0x254/0x6c0 write_cache_pages+0x254/0x6c0 do_writepages+0x192/0x310 filemap_fdatawrite_wbc+0x95/0xc0 __filemap_fdatawrite_range+0x99/0xd0 filemap_write_and_wait_range.part.0+0x4d/0xa0 blkdev_read_iter+0xef/0x1e0 io_read+0x1b6/0x8a0 io_issue_sqe+0x87/0x300 io_wq_submit_work+0xeb/0x390 io_worker_handle_work+0x24d/0x550 io_wq_worker+0x27f/0x6c0 ret_from_fork_asm+0x1b/0x30 </TASK> Allocated by task 808602: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x30 __kasan_slab_alloc+0x83/0x90 kmem_cache_alloc_node+0x1b1/0x6d0 bfq_get_queue+0x138/0xfa0 bfq_get_bfqq_handle_split+0xe3/0x2c0 bfq_init_rq+0x196/0xbb0 bfq_insert_request.isra.0+0xb5/0x480 bfq_insert_requests+0x156/0x180 blk_mq_insert_request+0x15d/0x440 blk_mq_submit_bio+0x8a4/0xb00 submit_bio_noacct_nocheck+0x331/0x400 __blkdev_direct_IO_async+0x2dd/0x330 blkdev_write_iter+0x39a/0x450 io_write+0x22a/0x840 io_issue_sqe+0x87/0x300 io_wq_submit_work+0xeb/0x390 io_worker_handle_work+0x24d/0x550 io_wq_worker+0x27f/0x6c0 ret_from_fork+0x2d/0x50 ret_from_fork_asm+0x1b/0x30 Freed by task 808589: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x30 kasan_save_free_info+0x27/0x40 __kasan_slab_free+0x126/0x1b0 kmem_cache_free+0x10c/0x750 bfq_put_queue+0x2dd/0x770 __bfq_insert_request.isra.0+0x155/0x7a0 bfq_insert_request.isra.0+0x122/0x480 bfq_insert_requests+0x156/0x180 blk_mq_dispatch_plug_list+0x528/0x7e0 blk_mq_flush_plug_list.part.0+0xe5/0x590 __blk_flush_plug+0x3b/0x90 blk_finish_plug+0x40/0x60 do_writepages+0x19d/0x310 filemap_fdatawrite_wbc+0x95/0xc0 __filemap_fdatawrite_range+0x99/0xd0 filemap_write_and_wait_range.part.0+0x4d/0xa0 blkdev_read_iter+0xef/0x1e0 io_read+0x1b6/0x8a0 io_issue_sqe+0x87/0x300 io_wq_submit_work+0xeb/0x390 io_worker_handle_work+0x24d/0x550 io_wq_worker+0x27f/0x6c0 ret_from_fork+0x2d/0x50 ret_from_fork_asm+0x1b/0x30 Fix the problem by protecting bic_to_bfqq() with bfqd->lock.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.133-1 | DEBIAN-CVE-2024-53166 |
| Debian:12 | linux | 6.1.133-1 | DSA-5900-1 |
| Debian:13 | linux | 6.12.3-1 | DEBIAN-CVE-2024-53166 |
| Debian:14 | linux | 6.12.3-1 | DEBIAN-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux | 6.8.0-58.60 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1027.29 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1027.29~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1027.32 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-azure-6.11 | 6.11.0-1012.12~24.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1027.32~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-azure-nvidia | 6.8.0-1014.15 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1028.30 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-gcp-6.11 | 6.11.0-1011.11~24.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1028.30~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1023.27 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1010.12 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-58.60~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1024.24 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | 6.8.0-1024.24~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-intel-iot-realtime | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-58.60.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-58.60.1~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1026.29 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-nvidia-6.11 | 6.11.0-1007.7 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1026.29~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1026.29.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-nvidia-tegra | 6.8.0-1008.8 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-oem-6.11 | 6.11.0-1015.15 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1026.26 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1024.25 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1024.25~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1028.32 | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-raspi-realtime | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-riscv | 6.8.0-58.60.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-58.60.1~22.04.1 | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2024-53166 |
| Ubuntu:24.04:LTS | linux-xilinx | 6.8.0-1017.18 | UBUNTU-CVE-2024-53166 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 76f1df88bbc2f984eb0418cc90de0a8384e63604 – before ada4ca5fd5a9d5212f28164d49a4885951c979c976f1df88bbc2f984eb0418cc90de0a8384e63604 – before 906cdbdd3b018ff69cc830173bce277a847d4fdc76f1df88bbc2f984eb0418cc90de0a8384e63604 – before dcaa738afde55085ac6056252e319479cf23cde276f1df88bbc2f984eb0418cc90de0a8384e63604 – before 01a853faaeaf3379ccf358ade582b1d28752126e76f1df88bbc2f984eb0418cc90de0a8384e63604 – before e8b8344de3980709080d86c157d24e7de07d70ad |
| Linux | Linux | 5.17 |
Weakness: CWE-416 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
References
- https://git.kernel.org/stable/c/ada4ca5fd5a9d5212f28164d49a4885951c979c9
- https://git.kernel.org/stable/c/906cdbdd3b018ff69cc830173bce277a847d4fdc
- https://git.kernel.org/stable/c/dcaa738afde55085ac6056252e319479cf23cde2
- https://git.kernel.org/stable/c/01a853faaeaf3379ccf358ade582b1d28752126e
- https://git.kernel.org/stable/c/e8b8344de3980709080d86c157d24e7de07d70ad
- https://lists.debian.org/debian-lts-announce/2025/05/msg00045.html
- https://cert-portal.siemens.com/productcert/html/ssa-082556.html
- https://cert-portal.siemens.com/productcert/html/ssa-784472.html