CVE-2024-47691: f2fs: fix to avoid use-after-free in f2fs_stop_gc_thread()

Published Oct 21, 2024
·
Updated

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

f2fs: fix to avoid use-after-free in f2fsstopgcthread()

syzbot reports a f2fs bug as below:

dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0x241/0x360 lib/dumpstack.c:114 printreport+0xe8/0x550 mm/kasan/report.c:491 kasanreport+0x143/0x180 mm/kasan/report.c:601 kasancheckrange+0x282/0x290 mm/kasan/generic.c:189 instrumentatomicreadwrite include/linux/instrumented.h:96 [inline] atomicfetchaddrelaxed include/linux/atomic/atomic-instrumented.h:252 [inline] refcountadd include/linux/refcount.h:184 [inline] refcountinc include/linux/refcount.h:241 [inline] refcountinc include/linux/refcount.h:258 [inline] gettaskstruct include/linux/sched/task.h:118 [inline] kthreadstop+0xca/0x630 kernel/kthread.c:704 f2fsstopgcthread+0x65/0xb0 fs/f2fs/gc.c:210 f2fsdoshutdown+0x192/0x540 fs/f2fs/file.c:2283 f2fsiocshutdown fs/f2fs/file.c:2325 [inline] f2fsioctl+0x443a/0xbe60 fs/f2fs/file.c:4325 vfsioctl fs/ioctl.c:51 [inline] dosysioctl fs/ioctl.c:907 [inline] sesysioctl+0xfc/0x170 fs/ioctl.c:893 dosyscallx64 arch/x86/entry/common.c:52 [inline] dosyscall64+0xf3/0x230 arch/x86/entry/common.c:83 entrySYSCALL64afterhwframe+0x77/0x7f

The root cause is below race condition, it may cause use-after-free issue in sbi->gcth pointer.

- remount - f2fsremount - f2fsstopgcthread - kfree(gcth) - f2fsiocshutdown - f2fsdoshutdown - f2fsstopgcthread - kthreadstop(gcth->f2fsgctask) : sbi->gcthread = NULL;

We will call f2fsdoshutdown() in two paths: - for f2fsiocshutdown() path, we should grab sb->sumount semaphore for fixing. - for f2fsshutdown() path, it's safe since caller has already grabbed sb->sumount semaphore.

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

4 affected componentsFixes available
Linux Linux kernel>=4.16<6.6.54
Linux Linux kernel>=6.7<6.10.13
Linux Linux kernel>=6.11<6.11.2
debian/linux<=5.10.223-1, <=5.10.234-1, <=6.1.129-1, <=6.1.135-1
6.12.25-16.12.27-1

Event History

Oct 21, 2024
CVE Published
via MITRE·11:53 AM
Data Sourced
via MITRE·11:53 AM
Description
Feb 20, 2025
Data Sourced
via Launchpad·12:46 AM
Description
May 7, 2025
Data Sourced
via Ubuntu·01:04 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-47691?

The severity of CVE-2024-47691 is rated as high due to its impact on the Linux kernel's stability.

2

How do I fix CVE-2024-47691?

To fix CVE-2024-47691, you should update your Linux kernel to a version that includes the patch for this vulnerability.

3

Which versions are affected by CVE-2024-47691?

CVE-2024-47691 affects Linux kernel versions between 4.16 and 6.6.54, as well as versions from 6.7 to 6.10.13 and 6.11 to 6.11.2.

4

Is CVE-2024-47691 a use-after-free vulnerability?

Yes, CVE-2024-47691 is identified as a use-after-free vulnerability in f2fs related to f2fs_stop_gc_thread().

5

What components are impacted by CVE-2024-47691?

CVE-2024-47691 impacts the f2fs (Flash-Friendly File System) component of the Linux kernel.

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