{"id":"CVE-2024-49868","aliases":["CVE-2024-49868"],"related":[],"kind":"vulnerability","state":"published","title":"btrfs: fix a NULL pointer dereference when failed to start a new trasacntion","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: btrfs: corrige una desreferencia de puntero NULL cuando no se puede iniciar una nueva transacción [ERROR] Syzbot informó una desreferencia de puntero NULL con el siguiente bloqueo: FAULT_INJECTION: forzando un fallo. 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 ... Información de BTRFS (dispositivo loop0): balance: finalizado con estado: -12 Vaya: error de protección general, probablemente para la dirección no canónica 0xdffffc00000000cc: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref en el rango [0x000000000000660-0x0000000000000667] RIP: 0010:btrfs_update_reloc_root+0x362/0xa80 fs/btrfs/relocation.c:926 Seguimiento de llamadas:  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 [en línea] 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 [CAUSA] El fallo de asignación ocurre en start_transaction() dentro de prepare_to_relocate(), y durante el manejo de errores llamamos a unset_reloc_control(), lo que hace que fs_info-&gt;balance_ctl sea NULL. Luego continuamos con la limpieza de la ruta de error en btrfs_balance() llamando a reset_balance_state() que llamará a del_balance_item() para eliminar por completo el elemento de balance en el árbol raíz. Sin embargo, durante la pequeña ventana entre set_reloc_contrl() y unset_reloc_control(), podemos tener una actualización del árbol de subvolumen y crear un reloc_root para ese subvolumen. Luego pasamos a la btrfs_commit_transaction() final de del_balance_item() y a btrfs_update_reloc_root() dentro de commit_fs_roots(). Esa función verifica si fs_info-&gt;reloc_ctl está en la etapa merge_reloc_tree, pero dado que fs_info-&gt;reloc_ctl es NULL, da como resultado una desreferencia de puntero NULL. [SOLUCIÓN] Solo hay que añadir una comprobación adicional en fs_info-&gt;reloc_ctl dentro de btrfs_update_reloc_root(), antes de comprobar fs_info-&gt;reloc_ctl-&gt;merge_reloc_tree. El manejo de DEAD_RELOC_TREE sirve para evitar modificaciones adicionales del árbol de reubicación durante la etapa de fusión, pero como no hay ningún reloc_ctl, no tenemos que preocuparnos por eso.","source":"nvd"}],"published":"2024-10-21T18:01:10.722Z","modified":"2026-06-17T08:00:37.190Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":["CWE-476"],"affected":[{"ranges":[{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"1282f001cbf56e5dd6e90a18e205a566793f4be0","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"d73d48acf36f57362df7e4f9d76568168bf5e944","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"37fee9c220b92c3b7bf22b51c51dde5364e7590b","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"d13249c0df7aab885acb149695f82c54c0822a70","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"7ad0c5868f2f0418619089513d95230c66cb7eb4","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"dc02c1440705e3451abd1c2c8114a5c1bb188e9f","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"39356ec0e319ed07627b3a0f402d0608546509e6","status":"affected"},{"type":"git","introduced":"3fd0a5585eb98e074fb9934549c8d85c49756c0d","fixed":"c3b47f49e83197e8dffd023ec568403bcdbb774b","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"2.6.35","status":"affected"},{"type":"semver","introduced":"0","fixed":"2.6.35","status":"unaffected"},{"type":"semver","introduced":"5.4.285","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.227","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.168","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.113","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.55","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.10.14","lastAffected":"6.10.*","status":"unaffected"},{"type":"semver","introduced":"6.11.3","lastAffected":"6.11.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.12","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","fixed":"5.10.227"},{"status":"affected","introduced":"5.11","fixed":"5.15.168"},{"status":"affected","introduced":"5.16","fixed":"6.1.113"},{"status":"affected","introduced":"6.2","fixed":"6.6.55"},{"status":"affected","introduced":"6.7","fixed":"6.10.14"},{"status":"affected","introduced":"6.11","fixed":"6.11.3"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/1282f001cbf56e5dd6e90a18e205a566793f4be0","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/d73d48acf36f57362df7e4f9d76568168bf5e944","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/37fee9c220b92c3b7bf22b51c51dde5364e7590b","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/d13249c0df7aab885acb149695f82c54c0822a70","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/7ad0c5868f2f0418619089513d95230c66cb7eb4","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/dc02c1440705e3451abd1c2c8114a5c1bb188e9f","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/39356ec0e319ed07627b3a0f402d0608546509e6","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c3b47f49e83197e8dffd023ec568403bcdbb774b","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html","tags":[],"sources":["cvelist","nvd"]},{"url":"https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2024-10-22T13:47:20.255Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2024-49868","url":"https://www.cve.org/CVERecord?id=CVE-2024-49868","licence":"CVE Terms of Use","modified":"2026-05-11T20:40:47.334Z"},{"source":"nvd","name":"NVD","id":"CVE-2024-49868","url":"https://nvd.nist.gov/vuln/detail/CVE-2024-49868","licence":"Public domain","modified":"2026-06-17T08:00:37.190Z"}],"updatedAt":"2026-11-25T22:58:47.016Z","epss":{"score":0.00288,"percentile":0.22954,"date":"2026-12-01T12:00:22.000Z"}}