CVE-2024-53218: f2fs: fix race in concurrent f2fs_stop_gc_thread

Published Dec 27, 2024
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

f2fs: fix race in concurrent f2fsstopgcthread

In my test case, concurrent calls to f2fs shutdown report the following stack trace:

Oops: general protection fault, probably for non-canonical address 0xc6cfff63bb5513fc: 0000 [#1] PREEMPT SMP PTI CPU: 0 UID: 0 PID: 678 Comm: f2fsrepshutdo Not tainted 6.12.0-rc5-next-20241029-g6fb2fa9805c5-dirty #85 Call Trace: <TASK> ? showregs+0x8b/0xa0 ? diebody+0x26/0xa0 ? dieaddr+0x54/0x90 ? excgeneralprotection+0x24b/0x5c0 ? asmexcgeneralprotection+0x26/0x30 ? kthreadstop+0x46/0x390 f2fsstopgcthread+0x6c/0x110 f2fsdoshutdown+0x309/0x3a0 f2fsiocshutdown+0x150/0x1c0 f2fsioctl+0xffd/0x2ac0 f2fsioctl+0x76/0xe0 vfsioctl+0x23/0x60 x64sysioctl+0xce/0xf0 x64syscall+0x2b1b/0x4540 dosyscall64+0xa7/0x240 entrySYSCALL64afterhwframe+0x76/0x7e

The root cause is a race condition in f2fsstopgcthread() called from different f2fs shutdown paths:

[CPU0] [CPU1] ---------------------- ----------------------- f2fsstopgcthread f2fsstopgcthread gcth = sbi->gcthread gcth = sbi->gcthread kfree(gcth) sbi->gcthread = NULL < gcth != NULL > kthreadstop(gcth->f2fsgctask) //UAF

The commit c7f114d864ac ("f2fs: fix to avoid use-after-free in f2fsstopgcthread()") attempted to fix this issue by using a read semaphore to prevent races between shutdown and remount threads, but it fails to prevent all race conditions.

Fix it by converting to write lock of sumount in f2fsdoshutdown().

Other sources

This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.

Launchpad

Affected Software

5 affected componentsFixes available
Linux Kernel
Linux Linux kernel>=4.16<6.6.64
Linux Linux kernel>=6.7<6.11.11
Linux Linux kernel>=6.12<6.12.2
debian/linux<=5.10.223-1, <=5.10.234-1, <=6.1.129-1, <=6.1.135-1
6.12.25-1

Event History

Dec 27, 2024
CVE Published
via MITRE·01:50 PM
Data Sourced
via MITRE·01:50 PM
Description
Apr 17, 2025
Data Sourced
via Launchpad·01:10 AM
Description
May 7, 2025
Data Sourced
via Ubuntu·01:14 AM
RemedyDescriptionSeverityAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2024-53218?

CVE-2024-53218 has a moderate severity level as it involves a race condition that can lead to a general protection fault.

2

What software versions are affected by CVE-2024-53218?

CVE-2024-53218 affects multiple versions of the Linux kernel, specifically versions up to 5.10.226-1 and 6.1.128-1.

3

How do I fix CVE-2024-53218?

To resolve CVE-2024-53218, update the Linux kernel to version 6.12.12-1 or later.

4

What is the nature of the issue in CVE-2024-53218?

CVE-2024-53218 involves a race condition in the f2fs filesystem during concurrent shutdown operations.

5

Can CVE-2024-53218 lead to data loss?

While CVE-2024-53218 primarily results in a crash, it may indirectly lead to data loss if the system is improperly shut down during operations.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203