{"id":"CVE-2024-49868","state":"PUBLISHED","title":"btrfs: fix a NULL pointer dereference when failed to start a new trasacntion","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix a NULL pointer dereference when failed to start a new trasacntion\n\n[BUG]\nSyzbot reported a NULL pointer dereference with the following crash:\n\n  FAULT_INJECTION: forcing a failure.\n   start_transaction+0x830/0x1670 fs/btrfs/transaction.c:676\n   prepare_to_relocate+0x31f/0x4c0 fs/btrfs/relocation.c:3642\n   relocate_block_group+0x169/0xd20 fs/btrfs/relocation.c:3678\n  ...\n  BTRFS info (device loop0): balance: ended with status: -12\n  Oops: general protection fault, probably for non-canonical address 0xdffffc00000000cc: 0000 [#1] PREEMPT SMP KASAN NOPTI\n  KASAN: null-ptr-deref in range [0x0000000000000660-0x0000000000000667]\n  RIP: 0010:btrfs_update_reloc_root+0x362/0xa80 fs/btrfs/relocation.c:926\n  Call Trace:\n   <TASK>\n   commit_fs_roots+0x2ee/0x720 fs/btrfs/transaction.c:1496\n   btrfs_commit_transaction+0xfaf/0x3740 fs/btrfs/transaction.c:2430\n   del_balance_item fs/btrfs/volumes.c:3678 [inline]\n   reset_balance_state+0x25e/0x3c0 fs/btrfs/volumes.c:3742\n   btrfs_balance+0xead/0x10c0 fs/btrfs/volumes.c:4574\n   btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3673\n   vfs_ioctl fs/ioctl.c:51 [inline]\n   __do_sys_ioctl fs/ioctl.c:907 [inline]\n   __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893\n   do_syscall_x64 arch/x86/entry/common.c:52 [inline]\n   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83\n   entry_SYSCALL_64_after_hwframe+0x77/0x7f\n\n[CAUSE]\nThe allocation failure happens at the start_transaction() inside\nprepare_to_relocate(), and during the error handling we call\nunset_reloc_control(), which makes fs_info->balance_ctl to be NULL.\n\nThen we continue the error path cleanup in btrfs_balance() by calling\nreset_balance_state() which will call del_balance_item() to fully delete\nthe balance item in the root tree.\n\nHowever during the small window between set_reloc_contrl() and\nunset_reloc_control(), we can have a subvolume tree update and created a\nreloc_root for that subvolume.\n\nThen we go into the final btrfs_commit_transaction() of\ndel_balance_item(), and into btrfs_update_reloc_root() inside\ncommit_fs_roots().\n\nThat function checks if fs_info->reloc_ctl is in the merge_reloc_tree\nstage, but since fs_info->reloc_ctl is NULL, it results a NULL pointer\ndereference.\n\n[FIX]\nJust add extra check on fs_info->reloc_ctl inside\nbtrfs_update_reloc_root(), before checking\nfs_info->reloc_ctl->merge_reloc_tree.\n\nThat DEAD_RELOC_TREE handling is to prevent further modification to the\nreloc tree during merge stage, but since there is no reloc_ctl at all,\nwe do not need to bother that.","publishedAt":"2024-10-21T18:01:10.722Z","updatedAt":"2026-05-11T20:40:47.334Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"1282f001cbf56e5dd6e90a18e205a566793f4be0","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"d73d48acf36f57362df7e4f9d76568168bf5e944","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"37fee9c220b92c3b7bf22b51c51dde5364e7590b","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"d13249c0df7aab885acb149695f82c54c0822a70","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"7ad0c5868f2f0418619089513d95230c66cb7eb4","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"dc02c1440705e3451abd1c2c8114a5c1bb188e9f","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"39356ec0e319ed07627b3a0f402d0608546509e6","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"c3b47f49e83197e8dffd023ec568403bcdbb774b","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.35","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.35","versionType":"semver"},{"version":"5.4.285","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.227","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.168","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.113","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.55","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.10.14","status":"unaffected","lessThanOrEqual":"6.10.*","versionType":"semver"},{"version":"6.11.3","status":"unaffected","lessThanOrEqual":"6.11.*","versionType":"semver"},{"version":"6.12","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]}],"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"],"weaknesses":[],"ingestedAt":"2026-10-29T20:07:56.516Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/49xxx/CVE-2024-49868.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-49868","state":"PUBLISHED","datePublished":"2024-10-21T18:01:10.722Z","dateUpdated":"2026-05-11T20:40:47.334Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-10-21T12:17:06.019Z"},"containers":{"cna":{"title":"btrfs: fix a NULL pointer dereference when failed to start a new trasacntion","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix a NULL pointer dereference when failed to start a new trasacntion\n\n[BUG]\nSyzbot reported a NULL pointer dereference with the following crash:\n\n  FAULT_INJECTION: forcing a failure.\n   start_transaction+0x830/0x1670 fs/btrfs/transaction.c:676\n   prepare_to_relocate+0x31f/0x4c0 fs/btrfs/relocation.c:3642\n   relocate_block_group+0x169/0xd20 fs/btrfs/relocation.c:3678\n  ...\n  BTRFS info (device loop0): balance: ended with status: -12\n  Oops: general protection fault, probably for non-canonical address 0xdffffc00000000cc: 0000 [#1] PREEMPT SMP KASAN NOPTI\n  KASAN: null-ptr-deref in range [0x0000000000000660-0x0000000000000667]\n  RIP: 0010:btrfs_update_reloc_root+0x362/0xa80 fs/btrfs/relocation.c:926\n  Call Trace:\n   <TASK>\n   commit_fs_roots+0x2ee/0x720 fs/btrfs/transaction.c:1496\n   btrfs_commit_transaction+0xfaf/0x3740 fs/btrfs/transaction.c:2430\n   del_balance_item fs/btrfs/volumes.c:3678 [inline]\n   reset_balance_state+0x25e/0x3c0 fs/btrfs/volumes.c:3742\n   btrfs_balance+0xead/0x10c0 fs/btrfs/volumes.c:4574\n   btrfs_ioctl_balance+0x493/0x7c0 fs/btrfs/ioctl.c:3673\n   vfs_ioctl fs/ioctl.c:51 [inline]\n   __do_sys_ioctl fs/ioctl.c:907 [inline]\n   __se_sys_ioctl+0xf9/0x170 fs/ioctl.c:893\n   do_syscall_x64 arch/x86/entry/common.c:52 [inline]\n   do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83\n   entry_SYSCALL_64_after_hwframe+0x77/0x7f\n\n[CAUSE]\nThe allocation failure happens at the start_transaction() inside\nprepare_to_relocate(), and during the error handling we call\nunset_reloc_control(), which makes fs_info->balance_ctl to be NULL.\n\nThen we continue the error path cleanup in btrfs_balance() by calling\nreset_balance_state() which will call del_balance_item() to fully delete\nthe balance item in the root tree.\n\nHowever during the small window between set_reloc_contrl() and\nunset_reloc_control(), we can have a subvolume tree update and created a\nreloc_root for that subvolume.\n\nThen we go into the final btrfs_commit_transaction() of\ndel_balance_item(), and into btrfs_update_reloc_root() inside\ncommit_fs_roots().\n\nThat function checks if fs_info->reloc_ctl is in the merge_reloc_tree\nstage, but since fs_info->reloc_ctl is NULL, it results a NULL pointer\ndereference.\n\n[FIX]\nJust add extra check on fs_info->reloc_ctl inside\nbtrfs_update_reloc_root(), before checking\nfs_info->reloc_ctl->merge_reloc_tree.\n\nThat DEAD_RELOC_TREE handling is to prevent further modification to the\nreloc tree during merge stage, but since there is no reloc_ctl at all,\nwe do not need to bother that."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"1282f001cbf56e5dd6e90a18e205a566793f4be0","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"d73d48acf36f57362df7e4f9d76568168bf5e944","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"37fee9c220b92c3b7bf22b51c51dde5364e7590b","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"d13249c0df7aab885acb149695f82c54c0822a70","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"7ad0c5868f2f0418619089513d95230c66cb7eb4","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"dc02c1440705e3451abd1c2c8114a5c1bb188e9f","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"39356ec0e319ed07627b3a0f402d0608546509e6","versionType":"git"},{"version":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","status":"affected","lessThan":"c3b47f49e83197e8dffd023ec568403bcdbb774b","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.35","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.35","versionType":"semver"},{"version":"5.4.285","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.227","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.168","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.113","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.55","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.10.14","status":"unaffected","lessThanOrEqual":"6.10.*","versionType":"semver"},{"version":"6.11.3","status":"unaffected","lessThanOrEqual":"6.11.*","versionType":"semver"},{"version":"6.12","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["fs/btrfs/relocation.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/1282f001cbf56e5dd6e90a18e205a566793f4be0"},{"url":"https://git.kernel.org/stable/c/d73d48acf36f57362df7e4f9d76568168bf5e944"},{"url":"https://git.kernel.org/stable/c/37fee9c220b92c3b7bf22b51c51dde5364e7590b"},{"url":"https://git.kernel.org/stable/c/d13249c0df7aab885acb149695f82c54c0822a70"},{"url":"https://git.kernel.org/stable/c/7ad0c5868f2f0418619089513d95230c66cb7eb4"},{"url":"https://git.kernel.org/stable/c/dc02c1440705e3451abd1c2c8114a5c1bb188e9f"},{"url":"https://git.kernel.org/stable/c/39356ec0e319ed07627b3a0f402d0608546509e6"},{"url":"https://git.kernel.org/stable/c/c3b47f49e83197e8dffd023ec568403bcdbb774b"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-05-11T20:40:47.334Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"5.4.285"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"5.10.227"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"5.15.168"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.1.113"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.6.55"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.10.14"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.11.3"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.35","versionEndExcluding":"6.12"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-49868","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-10-22T13:47:20.255256Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-10-22T13:48:52.367Z"}},{"title":"CVE Program Container","references":[{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html"},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html"}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2025-11-03T22:22:35.952Z"}}]}}}