# CVE-2024-41057: cachefiles: fix slab-use-after-free in cachefiles\_withdraw\_cookie()

> 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.36% (percentile 23, 2026-11-28)
- **CWE:** CWE-416
- **Published:** 2024-07-29T14:57:19.938Z
- **Modified:** 2026-08-05T11:35:03.575Z

## Who should check

- Anyone running Linux \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 8de253177112a47c9af157d23ae934779188b4e1; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< ef81340401e8a371d6b17f69e76d861920972cfe; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 5d8f805789072ea7fd39504694b7bd17e5f751c4
- Anyone running Linux 5.17

## Description

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

cachefiles: fix slab-use-after-free in cachefiles\_withdraw\_cookie()

We got the following issue in our fault injection stress test:

==================================================================
BUG: KASAN: slab-use-after-free in cachefiles\_withdraw\_cookie+0x4d9/0x600
Read of size 8 at addr ffff888118efc000 by task kworker/u78:0/109

CPU: 13 PID: 109 Comm: kworker/u78:0 Not tainted 6.8.0-dirty \#566
Call Trace:
 \<TASK\>
 kasan\_report+0x93/0xc0
 cachefiles\_withdraw\_cookie+0x4d9/0x600
 fscache\_cookie\_state\_machine+0x5c8/0x1230
 fscache\_cookie\_worker+0x91/0x1c0
 process\_one\_work+0x7fa/0x1800
 \[...\]

Allocated by task 117:
 kmalloc\_trace+0x1b3/0x3c0
 cachefiles\_acquire\_volume+0xf3/0x9c0
 fscache\_create\_volume\_work+0x97/0x150
 process\_one\_work+0x7fa/0x1800
 \[...\]

Freed by task 120301:
 kfree+0xf1/0x2c0
 cachefiles\_withdraw\_cache+0x3fa/0x920
 cachefiles\_put\_unbind\_pincount+0x1f6/0x250
 cachefiles\_daemon\_release+0x13b/0x290
 \_\_fput+0x204/0xa00
 task\_work\_run+0x139/0x230
 do\_exit+0x87a/0x29b0
 \[...\]
==================================================================

Following is the process that triggers the issue:

           p1                \|             p2
------------------------------------------------------------
                              fscache\_begin\_lookup
                               fscache\_begin\_volume\_access
                                fscache\_cache\_is\_live(fscache\_cache)
cachefiles\_daemon\_release
 cachefiles\_put\_unbind\_pincount
  cachefiles\_daemon\_unbind
   cachefiles\_withdraw\_cache
    fscache\_withdraw\_cache
     fscache\_set\_cache\_state(cache, FSCACHE\_CACHE\_IS\_WITHDRAWN);
    cachefiles\_withdraw\_objects(cache)
    fscache\_wait\_for\_objects(fscache)
      atomic\_read(&fscache\_cache-\>object\_count) == 0
                              fscache\_perform\_lookup
                               cachefiles\_lookup\_cookie
                                cachefiles\_alloc\_object
                                 refcount\_set(&object-\>ref, 1);
                                 object-\>volume = volume
                                 fscache\_count\_object(vcookie-\>cache);
                                  atomic\_inc(&fscache\_cache-\>object\_count)
    cachefiles\_withdraw\_volumes
     cachefiles\_withdraw\_volume
      fscache\_withdraw\_volume
      \_\_cachefiles\_free\_volume
       kfree(cachefiles\_volume)
                              fscache\_cookie\_state\_machine
                               cachefiles\_withdraw\_cookie
                                cache = object-\>volume-\>cache;
                                // cachefiles\_volume UAF !!!

After setting FSCACHE\_CACHE\_IS\_WITHDRAWN, wait for all the cookie lookups
to complete first, and then wait for fscache\_cache-\>object\_count == 0 to
avoid the cookie exiting after the volume has been freed and triggering
the above issue. Therefore call fscache\_withdraw\_volume() before calling
cachefiles\_withdraw\_objects().

This way, after setting FSCACHE\_CACHE\_IS\_WITHDRAWN, only the following two
cases will occur:
1) fscache\_begin\_lookup fails in fscache\_begin\_volume\_access().
2) fscache\_withdraw\_volume() will ensure that fscache\_count\_object() has
   been executed before calling fscache\_wait\_for\_objects().

## Affected and fixed versions

- Linux: \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 8de253177112a47c9af157d23ae934779188b4e1; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< ef81340401e8a371d6b17f69e76d861920972cfe; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 5d8f805789072ea7fd39504694b7bd17e5f751c4 (cvelist)
- Linux: 5.17 (cvelist)

## Mitigation

- Upgrade Linux to 5d8f805789072ea7fd39504694b7bd17e5f751c4 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-41057. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-41057.md
Affected: Linux >= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, < 8de253177112a47c9af157d23ae934779188b4e1; >= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, < 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11; >= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, < ef81340401e8a371d6b17f69e76d861920972cfe; >= fe2140e2f57fef8562e0f9b…
Fixed in: Linux 8de253177112a47c9af157d23ae934779188b4e1, Linux 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11, Linux 5d8f805789072ea7fd39504694b7bd17e5f751c4

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-2024-41057 being exploited?

There is no confirmed exploitation: CVE-2024-41057 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.36% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2024-41057?

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

### Which versions are affected by CVE-2024-41057?

Linux \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 8de253177112a47c9af157d23ae934779188b4e1; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< ef81340401e8a371d6b17f69e76d861920972cfe; \>= fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35, \< 5d8f805789072ea7fd39504694b7bd17e5f751c4; Linux 5.17.

### Is there a fix for CVE-2024-41057?

Yes. Fixed in Linux 8de253177112a47c9af157d23ae934779188b4e1, Linux 9e67589a4a7b7e5660b524d1d5fe61242bcbcc11, Linux 5d8f805789072ea7fd39504694b7bd17e5f751c4. Upgrade Linux to 5d8f805789072ea7fd39504694b7bd17e5f751c4 or later.

### How do I check if I'm affected by CVE-2024-41057?

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/8de253177112a47c9af157d23ae934779188b4e1>
- patch: <https://git.kernel.org/stable/c/9e67589a4a7b7e5660b524d1d5fe61242bcbcc11>
- patch: <https://git.kernel.org/stable/c/ef81340401e8a371d6b17f69e76d861920972cfe>
- patch: <https://git.kernel.org/stable/c/5d8f805789072ea7fd39504694b7bd17e5f751c4>
- other: <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>

## 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-2024-41057>

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