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

Published Feb 26, 2025
·
Updated

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

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

As Wenqing Liu reported in bugzilla:

https://bugzilla.kernel.org/showbug.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 testcrash 2. cd testcrash 3. unzip tmp2.zip 4. mkdir mnt 5. ./singletest.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] dumpstacklvl+0x47/0x5c [ 46.738581] ubsanepilogue+0x5/0x50 [ 46.738592] ubsanhandleoutofbounds+0x68/0x80 [ 46.738604] f2fsallocatedatablock+0xdff/0xe60 [f2fs] [ 46.738819] dowritepage+0xef/0x210 [f2fs] [ 46.738934] f2fsdowritenodepage+0x3f/0x80 [f2fs] [ 46.739038] writenodepage+0x2b7/0x920 [f2fs] [ 46.739162] f2fssyncnodepages+0x943/0xb00 [f2fs] [ 46.739293] f2fswritecheckpoint+0x7bb/0x1030 [f2fs] [ 46.739405] killf2fssuper+0x125/0x150 [f2fs] [ 46.739507] deactivatelockedsuper+0x60/0xc0 [ 46.739517] deactivatesuper+0x70/0xb0 [ 46.739524] cleanupmnt+0x11a/0x200 [ 46.739532] cleanupmnt+0x16/0x20 [ 46.739538] taskworkrun+0x67/0xa0 [ 46.739547] exittousermodeprepare+0x18c/0x1a0 [ 46.739559] syscallexittousermode+0x26/0x40 [ 46.739568] dosyscall64+0x46/0xb0 [ 46.739584] entrySYSCALL64afterhwframe+0x44/0xae

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

Affected Software

5 affected components
Linux Linux kernel>=5.17-rc4<5.17-rc6
Linux Linux kernel>=3.8<5.10.110
Linux Linux kernel>=5.11<5.15.33
Linux Linux kernel>=5.16<5.16.19
Linux Linux kernel>=5.17<5.17.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Linux kernel f2fs to a version that resolves this vulnerability.

    Fixed in 5.17.0-rc6
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

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

Event History

Feb 26, 2025
CVE Published
via MITRE·01:55 AM
Data Sourced
via MITRE·01:55 AM
DescriptionSeverity
Data Sourced
via NVD·07:00 AM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2022-49170?

CVE-2022-49170 is considered a moderate severity vulnerability affecting the Linux kernel due to the potential for out-of-bounds access.

2

How do I fix CVE-2022-49170?

To fix CVE-2022-49170, upgrade to a patched version of the Linux kernel that addresses this vulnerability.

3

Which versions of the Linux kernel are affected by CVE-2022-49170?

CVE-2022-49170 affects Linux kernel versions from 3.8 to 5.17-rc6.

4

What type of vulnerability is CVE-2022-49170?

CVE-2022-49170 is categorized as an out-of-bounds write vulnerability in the f2fs filesystem of the Linux kernel.

5

Who reported the CVE-2022-49170 vulnerability?

CVE-2022-49170 was reported by Wenqing Liu in the Linux bug tracking system.

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