# CVE-2026-31715: f2fs: fix UAF caused by decrementing sbi-\>nr\_pages\[\] in f2fs\_write\_end\_io()

- 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: 2026-05-01 · Modified: 2026-06-19
- Aliases: UBUNTU-CVE-2026-31715, DEBIAN-CVE-2026-31715, CGA-2q6g-pm2x-p2v2, CGA-558q-c4x7-gjvr, CGA-8v6x-gc4w-v6j6, CGA-958p-664g-gpw6, CGA-f47p-h5gr-4hg9, CGA-fwj9-r38v-76xf, CGA-fx37-9w47-mh68, CGA-gg7w-cc95-8mg4, CGA-p545-98c8-j575, CGA-pgxq-3qgh-5m87, CGA-v243-9858-pppq, CGA-xv2r-63qr-5p6x
- Record: https://cvemate.com/vulnerability/CVE-2026-31715 · JSON: https://cvemate.com/vulnerability/CVE-2026-31715/json

## Description

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

f2fs: fix UAF caused by decrementing sbi->nr_pages[] in f2fs_write_end_io()

The xfstests case "generic/107" and syzbot have both reported a NULL
pointer dereference.

The concurrent scenario that triggers the panic is as follows:

F2FS_WB_CP_DATA write callback          umount
                                        - f2fs_write_checkpoint
                                         - f2fs_wait_on_all_pages(sbi, F2FS_WB_CP_DATA)
- blk_mq_end_request
 - bio_endio
  - f2fs_write_end_io
   : dec_page_count(sbi, F2FS_WB_CP_DATA)
   : wake_up(&sbi->cp_wait)
                                        - kill_f2fs_super
                                         - kill_block_super
                                          - f2fs_put_super
                                           : iput(sbi->node_inode)
                                           : sbi->node_inode = NULL
   : f2fs_in_warm_node_list
    - is_node_folio // sbi->node_inode is NULL and panic

The root cause is that f2fs_put_super() calls iput(sbi->node_inode) and
sets sbi->node_inode to NULL after sbi->nr_pages[F2FS_WB_CP_DATA] is
decremented to zero. As a result, f2fs_in_warm_node_list() may
dereference a NULL node_inode when checking whether a folio belongs to
the node inode, leading to a panic.

This patch fixes the issue by calling f2fs_in_warm_node_list() before
decrementing sbi->nr_pages[F2FS_WB_CP_DATA], thus preventing the
use-after-free condition.
```

## 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.122%, percentile 2.124%, 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 169)

- chainguard linux-aws-6.12 (Chainguard): \< 6.12.85-r2
- chainguard linux-aws-6.18 (Chainguard): \< 6.18.31-r0
- chainguard linux-azure-6.12 (Chainguard): \< 6.12.85-r2
- chainguard linux-azure-6.18 (Chainguard): \< 6.18.31-r0 \| \< 6.18.24-r1
- chainguard linux-gcp-6.12 (Chainguard): All versions (No fix recorded)
- chainguard linux-gcp-6.18 (Chainguard): \< 6.18.31-r0
- chainguard linux-qemu-6.12 (Chainguard): All versions (No fix recorded)
- chainguard linux-qemu-6.18 (Chainguard): \< 6.18.24-r3
- chainguard linux-qemu-rc (Chainguard): \< 7.1\_rc3-r0
- chainguard linux-vmware-6.12 (Chainguard): \< 6.12.85-r2
- chainguard linux-vmware-6.18 (Chainguard): \< 6.18.31-r0
- debian linux (Debian): \< 6.1.176-1 \| \< 6.12.86-1 \| \< 7.0.3-1
- ubuntu linux (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-198.208 \| \< 6.8.0-136.136 \| \< 7.0.0-27.27
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1117.124 \| \< 6.8.0-1061.64 \| \< 7.0.0-1008.8
- 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-1117.124~20.04.1
- ubuntu linux-aws-5.19 (Ubuntu): All versions (No fix recorded)

## References (first 20 of 39)

- <https://git.kernel.org/stable/c/7dbdab4430e4654db9aacef12b9b3b8b29ca25cb>
- <https://git.kernel.org/stable/c/ffb94770dbdfb5411be5d9f44a960b010ec890ad>
- <https://git.kernel.org/stable/c/0d40b26377f891e6dcb6efaf8ef9374c99be1b1d>
- <https://git.kernel.org/stable/c/1171f329cf1c175321251ac40fd126150d7ad1e8>
- <https://git.kernel.org/stable/c/7be222de96c0f9eee6e65eeb017ef855ee185cfa>
- <https://git.kernel.org/stable/c/963d2e24d9d92a31e6773b0f642214f10013ebf7>
- <https://git.kernel.org/stable/c/188bb65f247a7a7c62f287c9a263aee3cad96fa5>
- <https://git.kernel.org/stable/c/2d9c4a4ed4eef1f82c5b16b037aee8bad819fd53>
- <https://ubuntu.com/security/CVE-2026-31715>
- <https://www.cve.org/CVERecord?id=CVE-2026-31715>
- <https://git.kernel.org/linus/2d9c4a4ed4eef1f82c5b16b037aee8bad819fd53>
- <https://ubuntu.com/security/notices/USN-8488-1>
- <https://ubuntu.com/security/notices/USN-8488-2>
- <https://ubuntu.com/security/notices/USN-8507-1>
- <https://ubuntu.com/security/notices/USN-8569-1>
- <https://ubuntu.com/security/notices/USN-8567-1>
- <https://ubuntu.com/security/notices/USN-8574-1>
- <https://ubuntu.com/security/notices/USN-8574-2>
- <https://ubuntu.com/security/notices/USN-8595-1>
- <https://ubuntu.com/security/notices/USN-8596-1>

---

Data as of 2026-12-05T06:21:56.086Z. 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
