Vulnerability · Published Oct 21, 2024 · Assigned by Linux
CVE-2024-49868btrfs: fix a NULL pointer dereference when failed to start a new trasacntion
Medium 5.5
In plain English
A medium-severity security flaw 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 21% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
In the Linux kernel, the following vulnerability has been resolved: btrfs: fix a NULL pointer dereference when failed to start a new trasacntion [BUG] Syzbot reported a NULL pointer dereference with the following crash: FAULT_INJECTION: forcing a failure. start_transaction+0x830/0x1670 fs/btrfs/transaction.c:676 prepare_to_relocate+0x31f/0x4c0 fs/btrfs/relocation.c:3642 relocate_block_group+0x169/0xd20 fs/btrfs/relocation.c:3678 ... BTRFS info (device loop0): balance: ended with status: -12 Oops: general protection fault, probably for non-canonical address 0xdffffc00000000cc: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000660-0x0000000000000667] RIP: 0010:btrfs_update_reloc_root+0x362/0xa80 fs/btrfs/relocation.c:926 Call Trace: <TASK> commit_fs_roots+0x2ee/0x720 fs/btrfs/transaction.c:1496 btrfs_commit_transaction+0xfaf/0x3740 fs/btrfs/transaction.c:2430 del_balance_item fs/btrfs/volumes.c:3678 [inline] reset_balance_state+0x25e/0x3c0 fs/btrfs/volumes.c:3742 btrfs_balance+0xead/0x10c0 fs/btrfs/volumes.c:4574 btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3673 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:907 [inline] __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f [CAUSE] The allocation failure happens at the start_transaction() inside prepare_to_relocate(), and during the error handling we call unset_reloc_control(), which makes fs_info->balance_ctl to be NULL. Then we continue the error path cleanup in btrfs_balance() by calling reset_balance_state() which will call del_balance_item() to fully delete the balance item in the root tree. However during the small window between set_reloc_contrl() and unset_reloc_control(), we can have a subvolume tree update and created a reloc_root for that subvolume. Then we go into the final btrfs_commit_transaction() of del_balance_item(), and into btrfs_update_reloc_root() inside commit_fs_roots(). That function checks if fs_info->reloc_ctl is in the merge_reloc_tree stage, but since fs_info->reloc_ctl is NULL, it results a NULL pointer dereference. [FIX] Just add extra check on fs_info->reloc_ctl inside btrfs_update_reloc_root(), before checking fs_info->reloc_ctl->merge_reloc_tree. That DEAD_RELOC_TREE handling is to prevent further modification to the reloc tree during merge stage, but since there is no reloc_ctl at all, we do not need to bother that.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.115-1 | DEBIAN-CVE-2024-49868 |
| Debian:13 | linux | 6.11.4-1 | DEBIAN-CVE-2024-49868 |
| Debian:14 | linux | 6.11.4-1 | DEBIAN-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux | 5.15.0-127.137 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux | 6.8.0-54.56 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-aws | 5.15.0-1073.79 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1023.25 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1023.25~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure | 5.15.0-1078.87 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1025.30 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-azure-6.11 | 6.11.0-1012.12~24.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1025.30~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-fde | 5.15.0-1078.87.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-azure-nvidia | 6.8.0-1014.15 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gcp | 5.15.0-1072.80 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1024.26 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-gcp-6.11 | 6.11.0-1011.11~24.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1024.26~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gke | 5.15.0-1070.76 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1019.23 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-gkeop | 5.15.0-1056.63 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1006.8 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-57.59~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-ibm | 5.15.0-1066.69 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1022.22 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | 6.8.0-1023.23~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-intel-iotg | 5.15.0-1071.77 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-kvm | 5.15.0-1070.75 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-lowlatency | 5.15.0-127.137 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-54.56.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-54.56.1~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-nvidia | 5.15.0-1068.69 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1022.25 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-nvidia-6.11 | 6.11.0-1007.7 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1022.25~22.04.2 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1022.25.2 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra | 5.15.0-1032.32 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra-igx | 5.15.0-1020.20 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-oem-6.11 | 6.11.0-1015.15 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1024.24 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oracle | 5.15.0-1071.77 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1020.21 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1020.21~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-raspi | 5.15.0-1066.69 | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1019.23 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-riscv | 6.8.0-53.55.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-53.55.1~22.04.1 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2024-49868 |
| Ubuntu:24.04:LTS | linux-xilinx | 6.8.0-1017.18 | UBUNTU-CVE-2024-49868 |
| Ubuntu:22.04:LTS | linux-xilinx-zynqmp | 5.15.0-1039.43 | UBUNTU-CVE-2024-49868 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 3fd0a5585eb98e074fb9934549c8d85c49756c0d – before 1282f001cbf56e5dd6e90a18e205a566793f4be03fd0a5585eb98e074fb9934549c8d85c49756c0d – before d73d48acf36f57362df7e4f9d76568168bf5e9443fd0a5585eb98e074fb9934549c8d85c49756c0d – before 37fee9c220b92c3b7bf22b51c51dde5364e7590b3fd0a5585eb98e074fb9934549c8d85c49756c0d – before d13249c0df7aab885acb149695f82c54c0822a703fd0a5585eb98e074fb9934549c8d85c49756c0d – before 7ad0c5868f2f0418619089513d95230c66cb7eb43fd0a5585eb98e074fb9934549c8d85c49756c0d – before dc02c1440705e3451abd1c2c8114a5c1bb188e9f3fd0a5585eb98e074fb9934549c8d85c49756c0d – before 39356ec0e319ed07627b3a0f402d0608546509e63fd0a5585eb98e074fb9934549c8d85c49756c0d – before c3b47f49e83197e8dffd023ec568403bcdbb774b |
| Linux | Linux | 2.6.35 |
References
- https://git.kernel.org/stable/c/1282f001cbf56e5dd6e90a18e205a566793f4be0
- https://git.kernel.org/stable/c/d73d48acf36f57362df7e4f9d76568168bf5e944
- https://git.kernel.org/stable/c/37fee9c220b92c3b7bf22b51c51dde5364e7590b
- https://git.kernel.org/stable/c/d13249c0df7aab885acb149695f82c54c0822a70
- https://git.kernel.org/stable/c/7ad0c5868f2f0418619089513d95230c66cb7eb4
- https://git.kernel.org/stable/c/dc02c1440705e3451abd1c2c8114a5c1bb188e9f
- https://git.kernel.org/stable/c/39356ec0e319ed07627b3a0f402d0608546509e6
- https://git.kernel.org/stable/c/c3b47f49e83197e8dffd023ec568403bcdbb774b
- https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html