{"id":"CVE-2024-47689","published":"2024-10-21T11:53:29Z","modified":"2026-05-23T15:53:41Z","title":"f2fs: fix to don't set SB_RDONLY in f2fs_handle_critical_error()","vendor":"Linux","product":"Linux","tier":"tail","description":{"text":"In the Linux kernel, the following vulnerability has been resolved:\n\nf2fs: fix to don't set SB_RDONLY in f2fs_handle_critical_error()\n\nsyzbot reports a f2fs bug as below:\n\n------------[ cut here ]------------\nWARNING: CPU: 1 PID: 58 at kernel/rcu/sync.c:177 rcu_sync_dtor+0xcd/0x180 kernel/rcu/sync.c:177\nCPU: 1 UID: 0 PID: 58 Comm: kworker/1:2 Not tainted 6.10.0-syzkaller-12562-g1722389b0d86 #0\nWorkqueue: events destroy_super_work\nRIP: 0010:rcu_sync_dtor+0xcd/0x180 kernel/rcu/sync.c:177\nCall Trace:\n percpu_free_rwsem+0x41/0x80 kernel/locking/percpu-rwsem.c:42\n destroy_super_work+0xec/0x130 fs/super.c:282\n process_one_work kernel/workqueue.c:3231 [inline]\n process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312\n worker_thread+0x86d/0xd40 kernel/workqueue.c:3390\n kthread+0x2f0/0x390 kernel/kthread.c:389\n ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147\n ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244\n\nAs Christian Brauner pointed out [1]: the root cause is f2fs sets\nSB_RDONLY flag in internal function, rather than setting the flag\ncovered w/ sb->s_umount semaphore via remount procedure, then below\nrace condition causes this bug:\n\n- freeze_super()\n - sb_wait_write(sb, SB_FREEZE_WRITE)\n - sb_wait_write(sb, SB_FREEZE_PAGEFAULT)\n - sb_wait_write(sb, SB_FREEZE_FS)\n\t\t\t\t\t- f2fs_handle_critical_error\n\t\t\t\t\t - sb->s_flags |= SB_RDONLY\n- thaw_super\n - thaw_super_locked\n  - sb_rdonly() is true, so it skips\n    sb_freeze_unlock(sb, SB_FREEZE_FS)\n  - deactivate_locked_super\n\nSince f2fs has almost the same logic as ext4 [2] when handling critical\nerror in filesystem if it mounts w/ errors=remount-ro option:\n- set CP_ERROR_FLAG flag which indicates filesystem is stopped\n- record errors to superblock\n- set SB_RDONLY falg\nOnce we set CP_ERROR_FLAG flag, all writable interfaces can detect the\nflag and stop any further updates on filesystem. So, it is safe to not\nset SB_RDONLY flag, let's remove the logic and keep in line w/ ext4 [3].\n\n[1] https://lore.kernel.org/all/20240729-himbeeren-funknetz-96e62f9c7aee@brauner\n[2] https://lore.kernel.org/all/20240729132721.hxih6ehigadqf7wx@quack3\n[3] https://lore.kernel.org/linux-ext4/20240805201241.27286-1-jack@suse.cz","provenance":"source","from":"CVE.org"},"cvss":null,"epss":{"score":0.00622,"percentile":0.50771,"provenance":"source"},"cwes":[],"references":[{"url":"https://git.kernel.org/stable/c/649ec8b30df113042588bd3d3cd4e98bcb1091e0","tags":[]},{"url":"https://git.kernel.org/stable/c/de43021c72993877a8f86f9fddfa0687609da5a4","tags":[]},{"url":"https://git.kernel.org/stable/c/1f63f405c1a1a64b9c310388aad7055fb86b245c","tags":[]},{"url":"https://git.kernel.org/stable/c/930c6ab93492c4b15436524e704950b364b2930c","tags":[]}],"priority":{"score":10.2,"factors":[{"name":"EPSS percentile","points":10.15}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, < 649ec8b30df113042588bd3d3cd4e98bcb1091e0",">= b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, < de43021c72993877a8f86f9fddfa0687609da5a4",">= b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, < 1f63f405c1a1a64b9c310388aad7055fb86b245c",">= b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, < 930c6ab93492c4b15436524e704950b364b2930c","ed1d478bf838820201f3fb67a1748fdf15954ea4",">= 6.4.4, < 6.5"]},{"vendor":"Linux","product":"Linux","versions":["6.5"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-10-21T13:06:11.931921Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2024-42609","exploited":false,"provenance":"source"}}