# CVE-2022-49170: f2fs: fix to do sanity check on curseg-\>alloc\_type

- 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: 2025-02-26 · Modified: 2026-08-12
- Aliases: UBUNTU-CVE-2022-49170, DEBIAN-CVE-2022-49170
- Record: https://cvemate.com/vulnerability/CVE-2022-49170 · JSON: https://cvemate.com/vulnerability/CVE-2022-49170/json

## Description

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

f2fs: fix to do sanity check on curseg->alloc_type

As Wenqing Liu reported in bugzilla:

https://bugzilla.kernel.org/show_bug.cgi?id=215657

- Overview
UBSAN: array-index-out-of-bounds in fs/f2fs/segment.c:3460:2 when mount and operate a corrupted image

- Reproduce
tested on kernel 5.17-rc4, 5.17-rc6

1. mkdir test_crash
2. cd test_crash
3. unzip tmp2.zip
4. mkdir mnt
5. ./single_test.sh f2fs 2

- Kernel dump
[   46.434454] loop0: detected capacity change from 0 to 131072
[   46.529839] F2FS-fs (loop0): Mounted with checkpoint version = 7548c2d9
[   46.738319] ================================================================================
[   46.738412] UBSAN: array-index-out-of-bounds in fs/f2fs/segment.c:3460:2
[   46.738475] index 231 is out of range for type 'unsigned int [2]'
[   46.738539] CPU: 2 PID: 939 Comm: umount Not tainted 5.17.0-rc6 #1
[   46.738547] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[   46.738551] Call Trace:
[   46.738556]  <TASK>
[   46.738563]  dump_stack_lvl+0x47/0x5c
[   46.738581]  ubsan_epilogue+0x5/0x50
[   46.738592]  __ubsan_handle_out_of_bounds+0x68/0x80
[   46.738604]  f2fs_allocate_data_block+0xdff/0xe60 [f2fs]
[   46.738819]  do_write_page+0xef/0x210 [f2fs]
[   46.738934]  f2fs_do_write_node_page+0x3f/0x80 [f2fs]
[   46.739038]  __write_node_page+0x2b7/0x920 [f2fs]
[   46.739162]  f2fs_sync_node_pages+0x943/0xb00 [f2fs]
[   46.739293]  f2fs_write_checkpoint+0x7bb/0x1030 [f2fs]
[   46.739405]  kill_f2fs_super+0x125/0x150 [f2fs]
[   46.739507]  deactivate_locked_super+0x60/0xc0
[   46.739517]  deactivate_super+0x70/0xb0
[   46.739524]  cleanup_mnt+0x11a/0x200
[   46.739532]  __cleanup_mnt+0x16/0x20
[   46.739538]  task_work_run+0x67/0xa0
[   46.739547]  exit_to_user_mode_prepare+0x18c/0x1a0
[   46.739559]  syscall_exit_to_user_mode+0x26/0x40
[   46.739568]  do_syscall_64+0x46/0xb0
[   46.739584]  entry_SYSCALL_64_after_hwframe+0x44/0xae

The root cause is we missed to do sanity check on curseg->alloc_type,
result in out-of-bound accessing on sbi->block_count[] array, fix it.
```

## Signals

- CVSS: 7.8 high (v3.1, CVE.org) CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS: 0.282%, percentile 22.153%, 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 111)

- debian linux (Debian): \< 5.17.3-1
- ubuntu linux (Ubuntu): All versions (No fix recorded) \| \< 4.4.0-291.325 \| \< 4.15.0-262.274 \| \< 5.4.0-242.262 \| \< 5.15.0-37.39
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): All versions (No fix recorded) \| \< 4.4.0-1162.168 \| \< 4.4.0-1200.215 \| \< 4.15.0-1199.212 \| \< 5.4.0-1165.176 \| \< 5.15.0-1011.14
- 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.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.3 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.4 (Ubuntu): All versions (No fix recorded) \| \< 5.4.0-1165.176~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-fips (Ubuntu): \< 4.15.0-2137.143 \| All versions (No fix recorded) \| \< 5.4.0-1165.176+fips1
- ubuntu linux-aws-hwe (Ubuntu): All versions (No fix recorded) \| \< 4.15.0-1199.212~16.04.1
- ubuntu linux-azure (Ubuntu): All versions (No fix recorded) \| \< 4.15.0-1209.224~14.04.1 \| \< 4.15.0-1209.224~16.04.1 \| \< 5.4.0-1170.176 \| \< 5.15.0-1010.12
- ubuntu linux-azure-4.15 (Ubuntu): All versions (No fix recorded) \| \< 4.15.0-1209.224
- 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-1008.9~20.04.1

## References

- <https://git.kernel.org/stable/c/498b7088db71f9707359448cd6800bbb1882f4c3>
- <https://git.kernel.org/stable/c/f68caedf264a95c0b02dfd0d9f92ac2637d5848a>
- <https://git.kernel.org/stable/c/0748a0f7dcb9d9dddc80302d73ebcecef6782ef0>
- <https://git.kernel.org/stable/c/c12765e3f129b144421c80d3383df885f85ee290>
- <https://git.kernel.org/stable/c/f41ee8b91c00770d718be2ff4852a80017ae9ab3>
- <https://ubuntu.com/security/CVE-2022-49170>
- <https://www.cve.org/CVERecord?id=CVE-2022-49170>
- <https://git.kernel.org/linus/f41ee8b91c00770d718be2ff4852a80017ae9ab3>
- <https://security-tracker.debian.org/tracker/CVE-2022-49170>
- <https://ubuntu.com/security/notices/USN-8919-1>
- <https://ubuntu.com/security/notices/USN-8920-1>
- <https://ubuntu.com/security/notices/USN-8965-1>
- <https://ubuntu.com/security/notices/USN-9033-1>
- <https://ubuntu.com/security/notices/USN-9032-1>
- <https://ubuntu.com/security/notices/USN-9034-1>
- <https://ubuntu.com/security/notices/USN-9164-1>

---

Data as of 2026-12-05T04:02:56.936Z. 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
