{"vuln_id":"CVE-2024-57976","aliases":[],"description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: do proper folio cleanup when cow_file_range() failed\n\n[BUG]\nWhen testing with COW fixup marked as BUG_ON() (this is involved with the\nnew pin_user_pages*() change, which should not result new out-of-band\ndirty pages), I hit a crash triggered by the BUG_ON() from hitting COW\nfixup path.\n\nThis BUG_ON() happens just after a failed btrfs_run_delalloc_range():\n\n  BTRFS error (device dm-2): failed to run delalloc range, root 348 ino 405 folio 65536 submit_bitmap 6-15 start 90112 len 106496: -28\n  ------------[ cut here ]------------\n  kernel BUG at fs/btrfs/extent_io.c:1444!\n  Internal error: Oops - BUG: 00000000f2000800 [#1] SMP\n  CPU: 0 UID: 0 PID: 434621 Comm: kworker/u24:8 Tainted: G           OE      6.12.0-rc7-custom+ #86\n  Hardware name: QEMU KVM Virtual Machine, BIOS unknown 2/2/2022\n  Workqueue: events_unbound btrfs_async_reclaim_data_space [btrfs]\n  pc : extent_writepage_io+0x2d4/0x308 [btrfs]\n  lr : extent_writepage_io+0x2d4/0x308 [btrfs]\n  Call trace:\n   extent_writepage_io+0x2d4/0x308 [btrfs]\n   extent_writepage+0x218/0x330 [btrfs]\n   extent_write_cache_pages+0x1d4/0x4b0 [btrfs]\n   btrfs_writepages+0x94/0x150 [btrfs]\n   do_writepages+0x74/0x190\n   filemap_fdatawrite_wbc+0x88/0xc8\n   start_delalloc_inodes+0x180/0x3b0 [btrfs]\n   btrfs_start_delalloc_roots+0x174/0x280 [btrfs]\n   shrink_delalloc+0x114/0x280 [btrfs]\n   flush_space+0x250/0x2f8 [btrfs]\n   btrfs_async_reclaim_data_space+0x180/0x228 [btrfs]\n   process_one_work+0x164/0x408\n   worker_thread+0x25c/0x388\n   kthread+0x100/0x118\n   ret_from_fork+0x10/0x20\n  Code: aa1403e1 9402f3ef aa1403e0 9402f36f (d4210000)\n  ---[ end trace 0000000000000000 ]---\n\n[CAUSE]\nThat failure is mostly from cow_file_range(), where we can hit -ENOSPC.\n\nAlthough the -ENOSPC is already a bug related to our space reservation\ncode, let's just focus on the error handling.\n\nFor example, we have the following dirty range [0, 64K) of an inode,\nwith 4K sector size and 4K page size:\n\n   0        16K        32K       48K       64K\n   |///////////////////////////////////////|\n   |#######################################|\n\nWhere |///| means page are still dirty, and |###| means the extent io\ntree has EXTENT_DELALLOC flag.\n\n- Enter extent_writepage() for page 0\n\n- Enter btrfs_run_delalloc_range() for range [0, 64K)\n\n- Enter cow_file_range() for range [0, 64K)\n\n- Function btrfs_reserve_extent() only reserved one 16K extent\n  So we created extent map and ordered extent for range [0, 16K)\n\n   0        16K        32K       48K       64K\n   |////////|//////////////////////////////|\n   |<- OE ->|##############################|\n\n   And range [0, 16K) has its delalloc flag cleared.\n   But since we haven't yet submit any bio, involved 4 pages are still\n   dirty.\n\n- Function btrfs_reserve_extent() returns with -ENOSPC\n  Now we have to run error cleanup, which will clear all\n  EXTENT_DELALLOC* flags and clear the dirty flags for the remaining\n  ranges:\n\n   0        16K        32K       48K       64K\n   |////////|                              |\n   |        |                              |\n\n  Note that range [0, 16K) still has its pages dirty.\n\n- Some time later, writeback is triggered again for the range [0, 16K)\n  since the page range still has dirty flags.\n\n- btrfs_run_delalloc_range() will do nothing because there is no\n  EXTENT_DELALLOC flag.\n\n- extent_writepage_io() finds page 0 has no ordered flag\n  Which falls into the COW fixup path, triggering the BUG_ON().\n\nUnfortunately this error handling bug dates back to the introduction of\nbtrfs.  Thankfully with the abuse of COW fixup, at least it won't crash\nthe kernel.\n\n[FIX]\nInstead of immediately unlocking the extent and folios, we keep the extent\nand folios locked until either erroring out or the whole delalloc range\nfinished.\n\nWhen the whole delalloc range finished without error, we just unlock the\nwhole range with PAGE_SET_ORDERED (and PAGE_UNLOCK for !keep_locked\ncases)\n---truncated---","published_at":"2025-02-27T02:15:10.790000Z","modified_at":"2026-10-30T13:17:49.503000Z","first_seen_at":"2026-11-24T10:34:01.216182Z","severity":"medium","severity_source":"nvd","cvss_score":5.5,"cvss_vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","cwe":["CWE-459"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":0.00268,"epss_percentile":0.19097,"nvd_status":"Modified","enriched_at":"2026-11-24T10:35:55.038922Z","links":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2024-57976"},"matched_alias":null,"items":[{"id":17959,"source":{"id":"ubuntu-usn","name":"Ubuntu Security Notices"},"title":"USN-9174-2: Linux kernel (Low Latency NVIDIA) vulnerabilities","summary":"Several security issues were discovered in the Linux kernel.\nAn attacker could possibly use these to compromise the system.\nThis update corrects flaws in the following subsystems:\n- Multiple devices driver;\n- eXpress Data Path;\n- Kernel build system;\n- ARM64 architecture;\n- PowerPC architecture;\n- RISC-V architecture;\n- S390 architecture;\n- x86 architecture;\n- Block layer subsystem;\n- Intel NPU Driver;\n- Compute Acceleration Framework;\n- ACPI drivers;\n- Drivers core;\n- Ublk userspace block driver;\n- Bus devices;\n- Hardware random number generator core;\n- Clock framework and drivers;\n- Clocksource drivers;\n- Hardware crypto device drivers;\n- CXL (Compute Express Link) drivers;\n- Buffer Sharing and Synchronization framework;\n- DMA engine subsystem;\n- DPLL subsystem;\n- EDAC drivers;\n- FireWire subsystem;\n- Arm Firmware Framework for ARMv8-A(FFA);\n- ARM SCMI message protocol;\n- GPIO subsystem;\n- GPU drivers;\n- HID subsystem;\n- Microsoft Hyper-V drivers;\n- Hardware monitoring drivers;\n- CoreSight HW tracing drivers;\n- I3C subsystem;\n- InfiniBand drivers;\n- Input Device core drivers;\n- Input Device (Mouse) drivers;\n- IOMMU subsystem;\n- Media drivers;\n- MMC subsystem;\n- Network drivers;\n- Mellanox network drivers;\n- Microsoft Azure Network Adapter (MANA) driver;\n- STMicroelectronics network drivers;\n- Texas Instruments network drivers;\n- Ethernet team driver;\n- MediaTek network drivers;\n- NTB driver;\n- NVME drivers;\n- Operating Performance Points (OPP) driver;\n- PCI subsystem;\n- Synopsys DesignWare PCIe PMU;\n- Pin controllers subsystem;\n- x86 platform drivers;\n- i.MX PM domains;\n- PTP clock framework;\n- PWM drivers;\n- Remote Processor subsystem;\n- S/390 drivers;\n- SCSI subsystem;\n- ASPEED SoC drivers;\n- SoundWire subsystem;\n- SPI subsystem;\n- Greybus lights staging drivers;\n- Realtek RTL8723BS SDIO drivers;\n- Thermal drivers;\n- TTY drivers;\n- UFS subsystem;\n- USB Gadget drivers;\n- USB Type-C Port Controller Manager driver;\n- vDPA drivers;\n- VFIO drivers;\n- Virtio Host (VHOST) subsystem;\n- Framebuffer layer;\n- ACRN Hypervisor Service Module driver;\n- Virtio drivers;\n- Watchdog drivers;\n- Xen hypervisor drivers;\n- AFS file system;\n- BTRFS file system;\n- Ceph distributed file system;\n- EROFS file system;\n- File systems infrastructure;\n- Ext4 file system;\n- F2FS file system;\n- GFS2 file system;\n- Network file systems library;\n- Network file system (NFS) client;\n- Network file system (NFS) server daemon;\n- NTFS3 file system;\n- OCFS2 file system;\n- Overlay file system;\n- Proc file system;\n- SMB network file system;\n- Tracing file system;\n- XFS file system;\n- BPF subsystem;\n- Control group (cgroup);\n- Memory Management;\n- MAC80211 subsystem;\n- KASAN memory debugging framework;\n- Mellanox drivers;\n- Networking core;\n- Netfilter;\n- Perf events;\n- Tracing infrastructure;\n- MediaTek SoC drivers;\n- RCU subsystem;\n- userfaultfd() syscall;\n- Amateur Radio drivers;\n- Bluetooth subsystem;\n- Wireless networking;\n- IPv4 networking;\n- IPv6 networking;\n- MultiProtocol Label Switching driver;\n- Network traffic control;\n- SCTP protocol;\n- TCP network protocol;\n- User-space API (UAPI);\n- IRQ subsystem;\n- Scheduler infrastructure;\n- Timer subsystem;\n- Memory management;\n- Ethernet bridge;\n- CAN network layer;\n- Ceph Core library;\n- Ethtool driver;\n- Handshake API;\n- IEEE802154.4 network protocol;\n- IFE protocol;\n- L2TP protocol;\n- Packet sockets;\n- Phonet protocol;\n- Qualcomm IPC Router (QRTR);\n- RxRPC session sockets;\n- SMC sockets;\n- Network sockets;\n- Sun RPC protocol;\n- TIPC protocol;\n- TLS protocol;\n- XFRM subsystem;\n- AppArmor security module;\n- SELinux security module;\n- ALSA framework;\n- Generic sound devices;\n- AMD SoC Alsa drivers;\n- Intel ASoC drivers;\n- QCOM ASoC drivers;\n- SOF drivers;\n- USB sound devices;\n- KVM subsystem;\n(CVE-2024-14040, CVE-2024-40954, CVE-2024-41008, CVE-2024-42107,\nCVE-2024-42139, CVE-2024-44951, CVE-2024-49940, CVE-2024-56544,\nCVE-2024-56702, CVE-2024-56712, CVE-2024-57809, CVE-2024-57857,\nCVE-2024-57976, CVE-2024-58012,…","url":"https://ubuntu.com/security/notices/USN-9174-2","published_at":"2026-11-24T08:40:59Z","updated_at":"2026-11-24T08:40:59Z","fetched_at":"2026-11-24T10:34:01.202503Z","severity":"high","cvss_score":7.8,"epss":0.00325,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"linux","product":null,"vuln_id":"CVE-2024-14040","vuln_ids":["CVE-2023-52452","CVE-2023-52490","CVE-2023-52586","CVE-2023-52590","CVE-2023-52591","CVE-2023-52653","CVE-2023-52671","CVE-2023-52751","CVE-2023-52770","CVE-2023-52771","CVE-2023-52888","CVE-2023-53149","CVE-2023-53261","CVE-2023-53394","CVE-2023-53447","CVE-2023-53523","CVE-2023-53781","CVE-2023-53823","CVE-2023-53846","CVE-2023-54013","CVE-2023-54107","CVE-2024-14040","CVE-2024-26661","CVE-2024-26662","CVE-2024-26669","CVE-2024-26670","CVE-2024-26677","CVE-2024-26690","CVE-2024-26740","CVE-2024-26799","CVE-2024-26841","CVE-2024-26866","CVE-2024-26869","CVE-2024-26876","CVE-2024-26886","CVE-2024-26889","CVE-2024-26947","CVE-2024-26948","CVE-2024-26953","CVE-2024-27010","CVE-2024-27011","CVE-2024-27022","CVE-2024-27041","CVE-2024-27057","CVE-2024-27062","CVE-2024-27408","CVE-2024-35784","CVE-2024-35799","CVE-2024-35860","CVE-2024-35904","CVE-2024-40954","CVE-2024-41008","CVE-2024-42107","CVE-2024-42139","CVE-2024-44951","CVE-2024-49940","CVE-2024-56544","CVE-2024-56702","CVE-2024-56712","CVE-2024-57809","CVE-2024-57857","CVE-2024-57976","CVE-2024-58012","USN-9174-2"],"tags":[],"cluster_id":3397,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/17959","html":"https://vulnwatch.ve1ve2.com/item/17959"}}]}