CVE-2024-57941

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-57941
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-57941.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-57941
Downstream
Published
2025-01-21T12:18:09Z
Modified
2025-10-17T19:57:18.401914Z
Summary
netfs: Fix the (non-)cancellation of copy when cache is temporarily disabled
Details

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

netfs: Fix the (non-)cancellation of copy when cache is temporarily disabled

When the caching for a cookie is temporarily disabled (e.g. due to a DIO write on that file), future copying to the cache for that file is disabled until all fds open on that file are closed. However, if netfslib is using the deprecated PGprivate2 method (such as is currently used by ceph), and decides it wants to copy to the cache, netfsadvancewrite() will just bail at the first check seeing that the cache stream is unavailable, and indicate that it dealt with all the content.

This means that we have no subrequests to provide notifications to drive the state machine or even to pin the request and the request just gets discarded, leaving the folios with PGprivate2 set.

Fix this by jumping directly to cancel the request if the cache is not available. That way, we don't remove mark3 from the folioqueue list and netfspgpriv2_cancel() will clean up the folios.

This was found by running the generic/013 xfstest against ceph with an active cache and the "-o fsc" option passed to ceph. That would usually hang

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
ee4cdf7ba857a894ad1650d6ab77669cbbfa329e
Fixed
ba37bdfe59fb43e80dd79290340a21864ba4b61e
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
ee4cdf7ba857a894ad1650d6ab77669cbbfa329e
Fixed
d0327c824338cdccad058723a31d038ecd553409

Affected versions

v6.*

v6.11
v6.11-rc7
v6.12
v6.12-rc1
v6.12-rc2
v6.12-rc3
v6.12-rc4
v6.12-rc5
v6.12-rc6
v6.12-rc7
v6.12.1
v6.12.2
v6.12.3
v6.12.4
v6.12.5
v6.12.6
v6.12.7
v6.12.8
v6.12.9
v6.13-rc1

Database specific

vanir_signatures

[
    {
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ba37bdfe59fb43e80dd79290340a21864ba4b61e",
        "id": "CVE-2024-57941-5107b876",
        "signature_type": "Function",
        "digest": {
            "length": 1145.0,
            "function_hash": "329975079089300476045390601782543254066"
        },
        "signature_version": "v1",
        "deprecated": false,
        "target": {
            "file": "fs/netfs/read_pgpriv2.c",
            "function": "netfs_pgpriv2_write_to_the_cache"
        }
    },
    {
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d0327c824338cdccad058723a31d038ecd553409",
        "id": "CVE-2024-57941-799bd732",
        "signature_type": "Line",
        "digest": {
            "threshold": 0.9,
            "line_hashes": [
                "242920548527967109114058886483416528867",
                "48576849361219058052318136956854982400",
                "267967876780973042052942542249220648103",
                "209685697655020479064165019397654132663"
            ]
        },
        "signature_version": "v1",
        "deprecated": false,
        "target": {
            "file": "fs/netfs/read_pgpriv2.c"
        }
    },
    {
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ba37bdfe59fb43e80dd79290340a21864ba4b61e",
        "id": "CVE-2024-57941-ca4afbce",
        "signature_type": "Line",
        "digest": {
            "threshold": 0.9,
            "line_hashes": [
                "242920548527967109114058886483416528867",
                "48576849361219058052318136956854982400",
                "267967876780973042052942542249220648103",
                "209685697655020479064165019397654132663"
            ]
        },
        "signature_version": "v1",
        "deprecated": false,
        "target": {
            "file": "fs/netfs/read_pgpriv2.c"
        }
    },
    {
        "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d0327c824338cdccad058723a31d038ecd553409",
        "id": "CVE-2024-57941-e76877bd",
        "signature_type": "Function",
        "digest": {
            "length": 1145.0,
            "function_hash": "329975079089300476045390601782543254066"
        },
        "signature_version": "v1",
        "deprecated": false,
        "target": {
            "file": "fs/netfs/read_pgpriv2.c",
            "function": "netfs_pgpriv2_write_to_the_cache"
        }
    }
]

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.12.0
Fixed
6.12.10