cve.bz

CVE-2025-40303 linux linux

7.8 highEPSS 0.1%Fix available

High (7.8) in linux linux. EPSS 0.1% estimated probability of exploitation activity in the next 30 days.

On this page
In the Linux kernel, the following vulnerability has been resolved: btrfs: ensure no dirty metadata is written back for an fs with errors [BUG] During development of a minor feature (make sure all btrfs_bio::end_io() is called in task context), I noticed a crash in generic/388, where metadata writes triggered new works after btrfs_stop_all_workers(). It turns out that it can even happen without any code modification, just using RAID5 for metadata and the same workload from generic/388 is going to trigger the use-after-free. [CAUSE] If btrfs hits an error, the fs is marked as error, no new transaction is allowed thus metadata is in a frozen state. But there are some metadata modifications before that error, and they are still in the btree inode page cache. Since there will be no real transaction commit, all those dirty folios are just kept as is in the page cache, and they can not be invalidated by invalidate_inode_pages2() call inside close_ctree(), because they are dirty. And finally after btrfs_stop_all_workers(), we call iput() on btree inode, which triggers writeback of those dirty metadata. And if the fs is using RAID56 metadata, this will trigger RMW and queue new works into rmw_workers, which is already stopped, causing warning from queue_work() and use-after-free. [FIX] Add a special handling for write_one_eb(), that if the fs is already in an error state, immediately mark the bbio as failure, instead of really submitting them. Then during close_ctree(), iput() will just discard all those dirty tree blocks without really writing them back, thus no more new jobs for already stopped-and-freed workqueues. The extra discard in write_one_eb() also acts as an extra safenet. E.g. the transaction abort is triggered by some extent/free space tree corruptions, and since extent/free space tree is already corrupted some tree blocks may be allocated where they shouldn't be (overwriting existing tree blocks). In that case writing them back will further corrupting the fs.

Severity

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
EPSS
0.1% (unchanged from 0.1% a week ago; 0.1% 30 days ago) estimated probability of exploitation activity in the next 30 days; 4th percentile. Scored 2026-11-15. A forecast for this CVE across the internet, not for your own systems.
Published
Modified
NVD analysis
Deferred: the NVD does not plan to analyze it
Record from
the NVD, synced

Fix and patched versions

  • Linux Linux: fixed in 6.6.117
  • Linux Linux: fixed in 6.12.58
  • Linux Linux: fixed in 6.17.8
  • Linux Linux: fixed in 6.18
  • Debian, Ubuntu, SUSE, openSUSE, Alpaquita: fixed package versions per release

Ask an AI about this CVE

Show the promptExplain CVE-2025-40303 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2025-40303?via=ask-ai-copy and https://cve.bz/cve/CVE-2025-40303?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2025-40303 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
Linux3.10 and later

Fixed in

ProductRelease lineFixed in
Linux6.66.6.117
Linux6.126.12.58
Linux6.176.17.8
Linuxlater releases6.18

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12linuxno fix listedDEBIAN-CVE-2025-40303
Debian13linux6.12.63-1DEBIAN-CVE-2025-40303
Debian14linux6.17.8-1DEBIAN-CVE-2025-40303
Ubuntu16.04:LTSlinux-hwe-edgeno fix listedUBUNTU-CVE-2025-40303
Ubuntu18.04:LTSlinux-gcp, linux-hwe, linux-oem and 12 moreno fix listedUBUNTU-CVE-2025-40303
Ubuntu20.04:LTSlinux-gke, linux-gkeop, linux-riscv and 26 moreno fix listedUBUNTU-CVE-2025-40303
Ubuntu22.04:LTSlinux, linux-aws, linux-gcp and 47 moreno fix listedUBUNTU-CVE-2025-40303
Ubuntu22.04:LTSlinux-aws-6.86.8.0-1050.53~22.04.1UBUNTU-CVE-2025-40303 USN-8095-4
Ubuntu22.04:LTSlinux-azure-6.86.8.0-1051.57~22.04.1UBUNTU-CVE-2025-40303 USN-8126-1
Ubuntu22.04:LTSlinux-azure-fde-6.86.8.0-1058.65~22.04.1UBUNTU-CVE-2025-40303
Ubuntu22.04:LTSlinux-gcp-6.86.8.0-1052.55~22.04.1UBUNTU-CVE-2025-40303 USN-8095-1
Ubuntu22.04:LTSlinux-hwe-6.8, linux-riscv-6.86.8.0-106.106~22.04.1UBUNTU-CVE-2025-40303 USN-8095-1
Ubuntu22.04:LTSlinux-ibm-6.86.8.0-1049.49~22.04.1UBUNTU-CVE-2025-40303 USN-8095-1
Ubuntu22.04:LTSlinux-lowlatency-hwe-6.86.8.0-106.106.1~22.04.1UBUNTU-CVE-2025-40303 USN-8095-1
Ubuntu22.04:LTSlinux-nvidia-6.86.8.0-1049.52~22.04.1UBUNTU-CVE-2025-40303 USN-8100-1
46 more for Ubuntu in the JSON and on Ubuntu's page.
SUSELinux Enterprise High Availability Extension 16.0kernel-default6.12.0-160000.9.1SUSE-SU-2026:20228-1
SUSELinux Enterprise Server 16.0, Linux Enterprise Server for SAP applications 16.0kernel-64kb, kernel-docs, kernel-syms and 6 more6.12.0-160000.9.1SUSE-SU-2026:20220-1
SUSELinux Enterprise Server 16.0, Linux Enterprise Server for SAP applications 16.0kernel-default-base6.12.0-160000.9.1.160000.2.6SUSE-SU-2026:20220-1
SUSELinux Micro 6.2kernel-default-base6.12.0-160000.9.1.160000.2.6SUSE-SU-2026:20207-1
SUSELinux Micro 6.2kernel-rt, kernel-64kb, kernel-source and 1 more6.12.0-160000.9.1SUSE-SU-2026:20207-1
SUSELinux Micro Extras 6.2kernel-syms, kernel-obs-build6.12.0-160000.9.1SUSE-SU-2026:20564-1
openSUSELeap 16.0kernel-default-base6.12.0-160000.9.1.160000.2.6openSUSE-SU-2026:20145-1
openSUSELeap 16.0kernel-rt, dtb-aarch64, kernel-64kb and 9 more6.12.0-160000.9.1openSUSE-SU-2026:20145-1
Alpaquita23linux-ltsno fix listedBELL-CVE-2025-40303
Alpaquita25linux-lts6.12.58-r0BELL-CVE-2025-40303
Alpaquitastreamlinux-lts6.18.35-r1BELL-CVE-2025-40303

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0; BellSoft's OSV database, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · SUSE · openSUSE · Alpaquita.

Red Hat

Red Hat rates this Low.

Red Hat's statement

Red Hat has rated the impact of this issue as Low. A use-after-free flaw was found in the Linux kernel's btrfs file system implementation. When a btrfs file system encounters an error and enters an error state, dirty metadata folios remaining in the btree inode page cache are written back during unmount, after the file system's worker threads have already been stopped. On file systems that use RAID56 metadata, this writeback triggers a read-modify-write operation that queues work into an already stopped and freed workqueue, causing a use-after-free that results in a kernel crash (denial of service). Exploiting this flaw requires a local attacker with the ability to run a workload that drives a btrfs file system using RAID56 metadata into an error state, and the consequence is limited to the availability of the local system.

Within Red Hat Enterprise Linux, only the kernel and kernel-rt packages in the RHEL 7 Extended Lifecycle Support (ELS) streams are affected, and the fix for those streams is currently deferred given the Low severity of the issue; the residual risk is a local denial of service (kernel crash at unmount) on systems using btrfs with RAID56 metadata that have already entered an error state. Red Hat Enterprise Linux 8, 9, and 10, and Red Hat In-Vehicle OS, are not affected because the vulnerable code is not present in those kernels. Red Hat's severity rating (CVSS 3.1 score 3.3, availability impact only) is significantly lower than the upstream CVE.org rating of 7.8 because exploitation requires local access and a specific btrfs RAID56 metadata configuration with the file system already in an error state, and the result is only a denial of service.

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 10kernelNot affected
Red Hat Enterprise Linux 6kernelOut of support scope
Red Hat Enterprise Linux 7kernelFix deferred
Red Hat Enterprise Linux 7kernel-rtFix deferred
Red Hat Enterprise Linux 8kernelNot affected
Red Hat Enterprise Linux 8kernel-rtNot affected
Red Hat Enterprise Linux 9kernelNot affected
Red Hat Enterprise Linux 9kernel-rtNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2025-40303.

References

Check your stackJSON