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

> 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, CNA) `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-129
- **Published:** 2025-02-26T01:55:27.562Z
- **Modified:** 2026-08-13T00:17:30.040Z

## Who should check

- Anyone running Linux \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< 498b7088db71f9707359448cd6800bbb1882f4c3; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< f68caedf264a95c0b02dfd0d9f92ac2637d5848a; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< 0748a0f7dcb9d9dddc80302d73ebcecef6782ef0; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< c12765e3f129b144421c80d3383df885f85ee290; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< f41ee8b91c00770d718be2ff4852a80017ae9ab3
- Anyone running Linux 3.8

## Description

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.

## Affected and fixed versions

- Linux: \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< 498b7088db71f9707359448cd6800bbb1882f4c3; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< f68caedf264a95c0b02dfd0d9f92ac2637d5848a; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< 0748a0f7dcb9d9dddc80302d73ebcecef6782ef0; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< c12765e3f129b144421c80d3383df885f85ee290; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< f41ee8b91c00770d718be2ff4852a80017ae9ab3 (cvelist)
- Linux: 3.8 (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-2022-49170. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-49170.md
Affected: Linux >= 351df4b201157351c7d26bf12c3eeb9dbce98854, < 498b7088db71f9707359448cd6800bbb1882f4c3; >= 351df4b201157351c7d26bf12c3eeb9dbce98854, < f68caedf264a95c0b02dfd0d9f92ac2637d5848a; >= 351df4b201157351c7d26bf12c3eeb9dbce98854, < 0748a0f7dcb9d9dddc80302d73ebcecef6782ef0; >= 351df4b201157351c7d26bf…
Fixed in: Linux 498b7088db71f9707359448cd6800bbb1882f4c3, Linux 0748a0f7dcb9d9dddc80302d73ebcecef6782ef0

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-2022-49170 being exploited?

There is no confirmed exploitation: CVE-2022-49170 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-2022-49170?

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

### Which versions are affected by CVE-2022-49170?

Linux \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< 498b7088db71f9707359448cd6800bbb1882f4c3; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< f68caedf264a95c0b02dfd0d9f92ac2637d5848a; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< 0748a0f7dcb9d9dddc80302d73ebcecef6782ef0; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< c12765e3f129b144421c80d3383df885f85ee290; \>= 351df4b201157351c7d26bf12c3eeb9dbce98854, \< f41ee8b91c00770d718be2ff4852a80017ae9ab3; Linux 3.8.

### Is there a fix for CVE-2022-49170?

Yes. Fixed in Linux 498b7088db71f9707359448cd6800bbb1882f4c3, Linux 0748a0f7dcb9d9dddc80302d73ebcecef6782ef0. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2022-49170?

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/498b7088db71f9707359448cd6800bbb1882f4c3>
- patch: <https://git.kernel.org/stable/c/f68caedf264a95c0b02dfd0d9f92ac2637d5848a>
- patch: <https://git.kernel.org/stable/c/0748a0f7dcb9d9dddc80302d73ebcecef6782ef0>
- patch: <https://git.kernel.org/stable/c/c12765e3f129b144421c80d3383df885f85ee290>
- patch: <https://git.kernel.org/stable/c/f41ee8b91c00770d718be2ff4852a80017ae9ab3>

## 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-2022-49170>

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