{"id":"CVE-2023-54023","summary":"btrfs: fix race between balance and cancel/pause","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix race between balance and cancel/pause\n\nSyzbot reported a panic that looks like this:\n\n  assertion failed: fs_info-\u003eexclusive_operation == BTRFS_EXCLOP_BALANCE_PAUSED, in fs/btrfs/ioctl.c:465\n  ------------[ cut here ]------------\n  kernel BUG at fs/btrfs/messages.c:259!\n  RIP: 0010:btrfs_assertfail+0x2c/0x30 fs/btrfs/messages.c:259\n  Call Trace:\n   \u003cTASK\u003e\n   btrfs_exclop_balance fs/btrfs/ioctl.c:465 [inline]\n   btrfs_ioctl_balance fs/btrfs/ioctl.c:3564 [inline]\n   btrfs_ioctl+0x531e/0x5b30 fs/btrfs/ioctl.c:4632\n   vfs_ioctl fs/ioctl.c:51 [inline]\n   __do_sys_ioctl fs/ioctl.c:870 [inline]\n   __se_sys_ioctl fs/ioctl.c:856 [inline]\n   __x64_sys_ioctl+0x197/0x210 fs/ioctl.c:856\n   do_syscall_x64 arch/x86/entry/common.c:50 [inline]\n   do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80\n   entry_SYSCALL_64_after_hwframe+0x63/0xcd\n\nThe reproducer is running a balance and a cancel or pause in parallel.\nThe way balance finishes is a bit wonky, if we were paused we need to\nsave the balance_ctl in the fs_info, but clear it otherwise and cleanup.\nHowever we rely on the return values being specific errors, or having a\ncancel request or no pause request.  If balance completes and returns 0,\nbut we have a pause or cancel request we won't do the appropriate\ncleanup, and then the next time we try to start a balance we'll trip\nthis ASSERT.\n\nThe error handling is just wrong here, we always want to clean up,\nunless we got -ECANCELLED and we set the appropriate pause flag in the\nexclusive op.  With this patch the reproducer ran for an hour without\ntripping, previously it would trip in less than a few minutes.","modified":"2026-03-31T17:30:01.338028964Z","published":"2025-12-24T10:55:52.835Z","related":["SUSE-SU-2026:0278-1","SUSE-SU-2026:0281-1","SUSE-SU-2026:0293-1","SUSE-SU-2026:0315-1","SUSE-SU-2026:20477-1","SUSE-SU-2026:20498-1","SUSE-SU-2026:20845-1","SUSE-SU-2026:20876-1"],"database_specific":{"cna_assigner":"Linux","osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/54xxx/CVE-2023-54023.json"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/72efe5d44821e38540888a5fe3ff3d0faab6acad"},{"type":"WEB","url":"https://git.kernel.org/stable/c/b19c98f237cd76981aaded52c258ce93f7daa8cb"},{"type":"WEB","url":"https://git.kernel.org/stable/c/ddf7e8984c83aee9122552529f4e77291903f8d9"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/54xxx/CVE-2023-54023.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-54023"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"837d5b6e46d1a4af5b6cc8f2fe83cb5de79a2961"},{"fixed":"ddf7e8984c83aee9122552529f4e77291903f8d9"},{"fixed":"72efe5d44821e38540888a5fe3ff3d0faab6acad"},{"fixed":"b19c98f237cd76981aaded52c258ce93f7daa8cb"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-54023.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.3.0"},{"fixed":"6.1.42"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.2.0"},{"fixed":"6.4.7"}]}],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2023-54023.json"}}],"schema_version":"1.7.5"}