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

- Priority: **Routine**
- Reason: Not severe (CVSS 7.8, local access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2024-10-21 · Modified: 2026-05-11
- Aliases: UBUNTU-CVE-2024-47691, DEBIAN-CVE-2024-47691
- Record: https://cvemate.com/vulnerability/CVE-2024-47691 · JSON: https://cvemate.com/vulnerability/CVE-2024-47691/json

## Description

```text
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.
```

## Signals

- CVSS: 7.8 high (v3.1, NVD) CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS: 0.237%, percentile 15.777%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 134)

- debian linux (Debian): All versions (No fix recorded) \| \< 6.11.2-1
- ubuntu linux (Ubuntu): \< 5.4.0-224.244 \| \< 5.15.0-164.174 \| \< 6.8.0-54.56
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): \< 5.4.0-1153.163 \| \< 5.15.0-1098.105 \| \< 6.8.0-1023.25
- ubuntu linux-aws-5.0 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.11 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.13 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.15 (Ubuntu): \< 5.15.0-1098.105~20.04.1
- ubuntu linux-aws-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.3 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.4 (Ubuntu): \< 5.4.0-1153.163~18.04.1
- ubuntu linux-aws-5.8 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.2 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.5 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.8 (Ubuntu): \< 6.8.0-1023.25~22.04.1
- ubuntu linux-aws-fips (Ubuntu): \< 5.4.0-1153.163+fips1 \| All versions (No fix recorded) \| \< 5.15.0-1098.105+fips1
- ubuntu linux-azure (Ubuntu): All versions (No fix recorded) \| \< 5.4.0-1156.163 \| \< 5.15.0-1102.111 \| \< 6.8.0-1025.30
- ubuntu linux-azure-5.11 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-azure-5.13 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-azure-5.15 (Ubuntu): \< 5.15.0-1102.111~20.04.1

## References (first 20 of 37)

- <https://git.kernel.org/stable/c/fc18e655b62ac6bc9f12f5de0d749b4a3fe1e812>
- <https://git.kernel.org/stable/c/7c339dee7eb0f8e4cadc317c595f898ef04dae30>
- <https://git.kernel.org/stable/c/d79343cd66343709e409d96b2abb139a0a55ce34>
- <https://git.kernel.org/stable/c/c7f114d864ac91515bb07ac271e9824a20f5ed95>
- <https://ubuntu.com/security/CVE-2024-47691>
- <https://www.cve.org/CVERecord?id=CVE-2024-47691>
- <https://git.kernel.org/linus/c7f114d864ac91515bb07ac271e9824a20f5ed95>
- <https://ubuntu.com/security/notices/USN-7276-1>
- <https://ubuntu.com/security/notices/USN-7277-1>
- <https://ubuntu.com/security/notices/USN-7301-1>
- <https://ubuntu.com/security/notices/USN-7303-1>
- <https://ubuntu.com/security/notices/USN-7304-1>
- <https://ubuntu.com/security/notices/USN-7303-2>
- <https://ubuntu.com/security/notices/USN-7310-1>
- <https://ubuntu.com/security/notices/USN-7311-1>
- <https://ubuntu.com/security/notices/USN-7303-3>
- <https://ubuntu.com/security/notices/USN-7384-1>
- <https://ubuntu.com/security/notices/USN-7385-1>
- <https://ubuntu.com/security/notices/USN-7386-1>
- <https://ubuntu.com/security/notices/USN-7384-2>

---

Data as of 2026-12-05T05:32:51.376Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
