# CVE-2024-47691: f2fs: fix to avoid use-after-free in f2fs\_stop\_gc\_thread()

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.31% (percentile 16, 2026-11-26)
- **CWE:** CWE-416
- **Published:** 2024-10-21T11:53:30.555Z
- **Modified:** 2026-06-17T07:57:33.040Z

## Who should check

- Anyone running Linux \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< fc18e655b62ac6bc9f12f5de0d749b4a3fe1e812; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< 7c339dee7eb0f8e4cadc317c595f898ef04dae30; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< d79343cd66343709e409d96b2abb139a0a55ce34; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< c7f114d864ac91515bb07ac271e9824a20f5ed95
- Anyone running Linux 4.16

## Description

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

f2fs: fix to avoid use-after-free in f2fs\_stop\_gc\_thread()

syzbot reports a f2fs bug as below:

 \_\_dump\_stack lib/dump\_stack.c:88 \[inline\]
 dump\_stack\_lvl+0x241/0x360 lib/dump\_stack.c:114
 print\_report+0xe8/0x550 mm/kasan/report.c:491
 kasan\_report+0x143/0x180 mm/kasan/report.c:601
 kasan\_check\_range+0x282/0x290 mm/kasan/generic.c:189
 instrument\_atomic\_read\_write include/linux/instrumented.h:96 \[inline\]
 atomic\_fetch\_add\_relaxed include/linux/atomic/atomic-instrumented.h:252 \[inline\]
 \_\_refcount\_add include/linux/refcount.h:184 \[inline\]
 \_\_refcount\_inc include/linux/refcount.h:241 \[inline\]
 refcount\_inc include/linux/refcount.h:258 \[inline\]
 get\_task\_struct include/linux/sched/task.h:118 \[inline\]
 kthread\_stop+0xca/0x630 kernel/kthread.c:704
 f2fs\_stop\_gc\_thread+0x65/0xb0 fs/f2fs/gc.c:210
 f2fs\_do\_shutdown+0x192/0x540 fs/f2fs/file.c:2283
 f2fs\_ioc\_shutdown fs/f2fs/file.c:2325 \[inline\]
 \_\_f2fs\_ioctl+0x443a/0xbe60 fs/f2fs/file.c:4325
 vfs\_ioctl fs/ioctl.c:51 \[inline\]
 \_\_do\_sys\_ioctl fs/ioctl.c:907 \[inline\]
 \_\_se\_sys\_ioctl+0xfc/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

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

- remount
 - f2fs\_remount
  - f2fs\_stop\_gc\_thread
   - kfree(gc\_th)
				- f2fs\_ioc\_shutdown
				 - f2fs\_do\_shutdown
				  - f2fs\_stop\_gc\_thread
				   - kthread\_stop(gc\_th-\>f2fs\_gc\_task)
   : sbi-\>gc\_thread = NULL;

We will call f2fs\_do\_shutdown() in two paths:
- for f2fs\_ioc\_shutdown() path, we should grab sb-\>s\_umount semaphore
for fixing.
- for f2fs\_shutdown() path, it's safe since caller has already grabbed
sb-\>s\_umount semaphore.

## Affected and fixed versions

- Linux: \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< fc18e655b62ac6bc9f12f5de0d749b4a3fe1e812; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< 7c339dee7eb0f8e4cadc317c595f898ef04dae30; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< d79343cd66343709e409d96b2abb139a0a55ce34; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< c7f114d864ac91515bb07ac271e9824a20f5ed95 (cvelist)
- Linux: 4.16 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-47691. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-47691.md
Affected: Linux >= 7950e9ac638e84518fbdd5c930939ad46a1068c5, < fc18e655b62ac6bc9f12f5de0d749b4a3fe1e812; >= 7950e9ac638e84518fbdd5c930939ad46a1068c5, < 7c339dee7eb0f8e4cadc317c595f898ef04dae30; >= 7950e9ac638e84518fbdd5c930939ad46a1068c5, < d79343cd66343709e409d96b2abb139a0a55ce34; >= 7950e9ac638e84518fbdd5c…
Fixed in: Linux 7c339dee7eb0f8e4cadc317c595f898ef04dae30

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-47691 being exploited?

There is no confirmed exploitation: CVE-2024-47691 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.31% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-47691?

High: CVSS 7.8 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-47691?

Linux \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< fc18e655b62ac6bc9f12f5de0d749b4a3fe1e812; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< 7c339dee7eb0f8e4cadc317c595f898ef04dae30; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< d79343cd66343709e409d96b2abb139a0a55ce34; \>= 7950e9ac638e84518fbdd5c930939ad46a1068c5, \< c7f114d864ac91515bb07ac271e9824a20f5ed95; Linux 4.16.

### Is there a fix for CVE-2024-47691?

Yes. Fixed in Linux 7c339dee7eb0f8e4cadc317c595f898ef04dae30. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2024-47691?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/fc18e655b62ac6bc9f12f5de0d749b4a3fe1e812>
- patch: <https://git.kernel.org/stable/c/7c339dee7eb0f8e4cadc317c595f898ef04dae30>
- patch: <https://git.kernel.org/stable/c/d79343cd66343709e409d96b2abb139a0a55ce34>
- patch: <https://git.kernel.org/stable/c/c7f114d864ac91515bb07ac271e9824a20f5ed95>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-47691>

HTML: <https://flawdb.com/CVE-2024-47691> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-47691>
