# CVE-2024-36001: netfs: Fix the pre-flush when appending to a file in writethrough mode

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.21%, higher than 11% of CVEs (2026-12-01)
- Published: 2024-05-20T09:48:02.966Z
- Modified: 2026-08-05T11:31:31.727Z
- Weaknesses: CWE-787
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

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

netfs: Fix the pre-flush when appending to a file in writethrough mode

In netfs_perform_write(), when the file is marked NETFS_ICTX_WRITETHROUGH
or O_*SYNC or RWF_*SYNC was specified, write-through caching is performed
on a buffered file.  When setting up for write-through, we flush any
conflicting writes in the region and wait for the write to complete,
failing if there's a write error to return.

The issue arises if we're writing at or above the EOF position because we
skip the flush and - more importantly - the wait.  This becomes a problem
if there's a partial folio at the end of the file that is being written out
and we want to make a write to it too.  Both the already-running write and
the write we start both want to clear the writeback mark, but whoever is
second causes a warning looking something like:

    ------------[ cut here ]------------
    R=00000012: folio 11 is not under writeback
    WARNING: CPU: 34 PID: 654 at fs/netfs/write_collect.c:105
    ...
    CPU: 34 PID: 654 Comm: kworker/u386:27 Tainted: G S ...
    ...
    Workqueue: events_unbound netfs_write_collection_worker
    ...
    RIP: 0010:netfs_writeback_lookup_folio

Fix this by making the flush-and-wait unconditional.  It will do nothing if
there are no folios in the pagecache and will return quickly if there are
no folios in the region specified.

Further, move the WBC attachment above the flush call as the flush is going
to attach a WBC and detach it again if it is not present - and since we
need one anyway we might as well share it.

(As written by CVE List.)

## Affected

- Linux Linux: from 41d8e7673a7726cba57cb8112d81c89cfb6c3e35 before 5eaf23b2e81349f6614f88396dc468fda89fc0b9; from 41d8e7673a7726cba57cb8112d81c89cfb6c3e35 before c97f59e276d4e93480f29a70accbd0d7273cf3f5; 6.8 (not affected: before 6.8; from 6.8.9 up to 6.8.*; from 6.9 up to *)
- linux linux_kernel: from 6.8 before 6.8.9; 6.9

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/5eaf23b2e81349f6614f88396dc468fda89fc0b9> (patch)
- <https://git.kernel.org/stable/c/c97f59e276d4e93480f29a70accbd0d7273cf3f5> (patch)

## Sources

- CVE List: [CVE-2024-36001](https://www.cve.org/CVERecord?id=CVE-2024-36001), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2024-36001](https://nvd.nist.gov/vuln/detail/CVE-2024-36001), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2024-36001 · Whole record: https://cve.day/CVE-2024-36001.json · Rebuilt by cve.day 2026-11-25T22:58:40.662Z
