cve.bz

CVE-2025-21825 linux linux kernel: Double Free

4.7 mediumEPSS 0.2%Fix available

Medium (4.7) in linux linux kernel. EPSS 0.2% estimated probability of exploitation activity in the next 30 days.

On this page
In the Linux kernel, the following vulnerability has been resolved: bpf: Cancel the running bpf_timer through kworker for PREEMPT_RT During the update procedure, when overwrite element in a pre-allocated htab, the freeing of old_element is protected by the bucket lock. The reason why the bucket lock is necessary is that the old_element has already been stashed in htab->extra_elems after alloc_htab_elem() returns. If freeing the old_element after the bucket lock is unlocked, the stashed element may be reused by concurrent update procedure and the freeing of old_element will run concurrently with the reuse of the old_element. However, the invocation of check_and_free_fields() may acquire a spin-lock which violates the lockdep rule because its caller has already held a raw-spin-lock (bucket lock). The following warning will be reported when such race happens: BUG: scheduling while atomic: test_progs/676/0x00000003 3 locks held by test_progs/676: #0: ffffffff864b0240 (rcu_read_lock_trace){....}-{0:0}, at: bpf_prog_test_run_syscall+0x2c0/0x830 #1: ffff88810e961188 (&htab->lockdep_key){....}-{2:2}, at: htab_map_update_elem+0x306/0x1500 #2: ffff8881f4eac1b8 (&base->softirq_expiry_lock){....}-{2:2}, at: hrtimer_cancel_wait_running+0xe9/0x1b0 Modules linked in: bpf_testmod(O) Preemption disabled at: [<ffffffff817837a3>] htab_map_update_elem+0x293/0x1500 CPU: 0 UID: 0 PID: 676 Comm: test_progs Tainted: G ... 6.12.0+ #11 Tainted: [W]=WARN, [O]=OOT_MODULE Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)... Call Trace: <TASK> dump_stack_lvl+0x57/0x70 dump_stack+0x10/0x20 __schedule_bug+0x120/0x170 __schedule+0x300c/0x4800 schedule_rtlock+0x37/0x60 rtlock_slowlock_locked+0x6d9/0x54c0 rt_spin_lock+0x168/0x230 hrtimer_cancel_wait_running+0xe9/0x1b0 hrtimer_cancel+0x24/0x30 bpf_timer_delete_work+0x1d/0x40 bpf_timer_cancel_and_free+0x5e/0x80 bpf_obj_free_fields+0x262/0x4a0 check_and_free_fields+0x1d0/0x280 htab_map_update_elem+0x7fc/0x1500 bpf_prog_9f90bc20768e0cb9_overwrite_cb+0x3f/0x43 bpf_prog_ea601c4649694dbd_overwrite_timer+0x5d/0x7e bpf_prog_test_run_syscall+0x322/0x830 __sys_bpf+0x135d/0x3ca0 __x64_sys_bpf+0x75/0xb0 x64_sys_call+0x1b5/0xa10 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x4b/0x53 ... </TASK> It seems feasible to break the reuse and refill of per-cpu extra_elems into two independent parts: reuse the per-cpu extra_elems with bucket lock being held and refill the old_element as per-cpu extra_elems after the bucket lock is unlocked. However, it will make the concurrent overwrite procedures on the same CPU return unexpected -E2BIG error when the map is full. Therefore, the patch fixes the lock problem by breaking the cancelling of bpf_timer into two steps for PREEMPT_RT: 1) use hrtimer_try_to_cancel() and check its return value 2) if the timer is running, use hrtimer_cancel() through a kworker to cancel it again Considering that the current implementation of hrtimer_cancel() will try to acquire a being held softirq_expiry_lock when the current timer is running, these steps above are reasonable. However, it also has downside. When the timer is running, the cancelling of the timer is delayed when releasing the last map uref. The delay is also fixable (e.g., break the cancelling of bpf timer into two parts: one part in locked scope, another one in unlocked scope), it can be revised later if necessary. It is a bit hard to decide the right fix tag. One reason is that the problem depends on PREEMPT_RT which is enabled in v6.12. Considering the softirq_expiry_lock lock exists since v5.4 and bpf_timer is introduced in v5.15, the bpf_timer commit is used in the fixes tag and an extra depends-on tag is added to state the dependency on PREEMPT_RT. Depends-on: v6.12+ with PREEMPT_RT enabled

Severity

CVSS 3.1

4.7 medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
EPSS
0.2% (unchanged from 0.2% a week ago; 0.2% 30 days ago) estimated probability of exploitation activity in the next 30 days; 12th percentile. Scored 2026-11-15. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: total, assessed 2026-10-15. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-415 Double Free
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2025-21825 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2025-21825?via=ask-ai-copy and https://cve.bz/cve/CVE-2025-21825?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-21825 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
Linux5.15 and later

Fixed in

ProductRelease lineFixed in
Linux6.66.6.160
Linux6.126.12.13
Linux6.136.13.2
Linuxlater releases6.14

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian12linuxno fix listedDEBIAN-CVE-2025-21825
Debian13, 14linux6.12.13-1DEBIAN-CVE-2025-21825
Ubuntu16.04:LTSlinux-hwe-edgeno fix listedUBUNTU-CVE-2025-21825
Ubuntu18.04:LTSlinux-gcp, linux-hwe, linux-oem and 12 moreno fix listedUBUNTU-CVE-2025-21825
Ubuntu20.04:LTSlinux-gke, linux-gkeop, linux-riscv and 26 moreno fix listedUBUNTU-CVE-2025-21825
Ubuntu22.04:LTSlinux, linux-aws, linux-gcp and 47 moreno fix listedUBUNTU-CVE-2025-21825
Ubuntu22.04:LTSlinux-aws-6.86.8.0-1032.34~22.04.1UBUNTU-CVE-2025-21825 USN-7651-3
Ubuntu22.04:LTSlinux-azure-6.86.8.0-1034.39~22.04.1UBUNTU-CVE-2025-21825 USN-7737-1
Ubuntu22.04:LTSlinux-gcp-6.86.8.0-1033.35~22.04.1UBUNTU-CVE-2025-21825 USN-7651-4
Ubuntu22.04:LTSlinux-hwe-6.8, linux-riscv-6.86.8.0-64.67~22.04.1UBUNTU-CVE-2025-21825 USN-7653-1
Ubuntu22.04:LTSlinux-ibm-6.86.8.0-1029.29~22.04.1UBUNTU-CVE-2025-21825 USN-7651-2
Ubuntu22.04:LTSlinux-lowlatency-hwe-6.86.8.0-64.67.1~22.04.1UBUNTU-CVE-2025-21825 USN-7651-2
Ubuntu22.04:LTSlinux-nvidia-6.86.8.0-1031.34~22.04.1UBUNTU-CVE-2025-21825 USN-7651-3
Ubuntu22.04:LTSlinux-oracle-6.86.8.0-1029.30~22.04.1UBUNTU-CVE-2025-21825 USN-7651-3
30 more for Ubuntu in the JSON and on Ubuntu's page.
SUSELinux Enterprise High Availability Extension 15 SP6, Linux Enterprise Live Patching 15 SP6, Linux Enterprise Module for Legacy 15 SP6 and 1 morekernel-default6.4.0-150600.23.47.2SUSE-SU-2025:1180-1
SUSELinux Enterprise Live Patching 15 SP6kernel-livepatch-SLE15-SP6-RT_Update_101-150600.1.5.1SUSE-SU-2025:1178-1
SUSELinux Enterprise Live Patching 15 SP6kernel-livepatch-SLE15-SP6_Update_101-150600.13.5.1SUSE-SU-2025:1180-1
SUSELinux Enterprise Module for Basesystem 15 SP6kernel-64kb, kernel-source, kernel-default and 1 more6.4.0-150600.23.47.2SUSE-SU-2025:1180-1
SUSELinux Enterprise Module for Basesystem 15 SP6kernel-default-base6.4.0-150600.23.47.2.150600.12.20.2SUSE-SU-2025:1180-1
SUSELinux Enterprise Module for Confidential Computing Technical Preview 15 SP6kernel-coco, kernel-syms-coco, kernel-coco_debug and 1 more6.4.0-15061.21.coco15sp6.1SUSE-SU-2025:01919-1
SUSELinux Enterprise Module for Development Tools 15 SP6kernel-docs, kernel-syms, kernel-obs-build6.4.0-150600.23.47.1SUSE-SU-2025:1180-1
SUSELinux Enterprise Module for Development Tools 15 SP6kernel-source6.4.0-150600.23.47.2SUSE-SU-2025:1180-1
SUSELinux Enterprise Module for Public Cloud 15 SP6kernel-azure, kernel-source-azure6.4.0-150600.8.34.2SUSE-SU-2025:1177-1
SUSELinux Enterprise Module for Public Cloud 15 SP6kernel-syms-azure6.4.0-150600.8.34.1SUSE-SU-2025:1177-1
SUSELinux Micro 6.0kernel-default-base6.4.0-28.1.21.6SUSE-SU-2025:20192-1
SUSELinux Micro 6.0kernel-livepatch-MICRO-6-0-RT_Update_61-3.1SUSE-SU-2025:20190-1
9 more for SUSE in the JSON and on SUSE's page.
openSUSELeap 15.6dtb-aarch64, kernel-docs, kernel-syms and 2 more6.4.0-150600.23.47.1SUSE-SU-2025:1180-1
openSUSELeap 15.6kernel-64kb, kernel-debug, kernel-source and 3 more6.4.0-150600.23.47.2SUSE-SU-2025:1180-1
openSUSELeap 15.6kernel-azure, kernel-source-azure6.4.0-150600.8.34.2SUSE-SU-2025:1177-1
openSUSELeap 15.6kernel-default-base6.4.0-150600.23.47.2.150600.12.20.2SUSE-SU-2025:1180-1
openSUSELeap 15.6kernel-rt, kernel-syms-rt, kernel-rt_debug and 1 more6.4.0-150600.10.34.1SUSE-SU-2025:1178-1
openSUSELeap 15.6kernel-syms-azure6.4.0-150600.8.34.1SUSE-SU-2025:1177-1
Azure Linux2kernelno fix listedAZL-69488
Azure Linux3kernelno fix listedAZL-62534
Alpaquita23linux-ltsno fix listedBELL-CVE-2025-21825
Alpaquita25linux-lts6.12.41-r0BELL-CVE-2025-21825
Alpaquitastreamlinux-lts6.18.35-r1BELL-CVE-2025-21825

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; Microsoft's Azure Linux vulnerability data, MIT; 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 assessed this Linux kernel BPF flaw as having low security impact. When overwriting an element in a pre-allocated BPF hash table (htab) map, the kernel may need to cancel a running bpf_timer while the hash bucket lock is held. On kernels built with PREEMPT_RT, that cancellation path can try to acquire a sleeping lock from atomic context, violating the kernel locking rules and triggering a "BUG: scheduling while atomic" warning. A local user with the ability to run BPF operations (for example, loading and running BPF programs that use bpf timers in pre-allocated hash table maps) on a PREEMPT_RT configuration could use this flaw to trigger that warning, potentially causing local denial of service. The issue depends on PREEMPT_RT being enabled (upstream v6.12 and later) and on bpf_timer support (introduced upstream in v5.15).

Red Hat Enterprise Linux 6 and 8 are not affected because the vulnerable code is not present. Red Hat Enterprise Linux 7 is out of active support scope. Red Hat Enterprise Linux 9 and 10 (kernel and kernel-rt) and Red Hat In-Vehicle OS are affected, with fixes currently deferred because of the low impact of this flaw: triggering it requires local access with privileges to perform BPF operations on a real-time (PREEMPT_RT) kernel configuration, and the verified effect is limited to availability impact (a kernel warning/scheduling bug) with no confidentiality or integrity impact. The residual risk of the deferral is that a suitably privileged local user on an affected PREEMPT_RT configuration could trigger the scheduling-while-atomic bug and degrade system availability.

The CVE record assigner has scored this flaw 7.8 (Important), while Red Hat rates it low (3.3, CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:L); the higher upstream score assumes full confidentiality, integrity, and availability impact, whereas the verified technical effect is limited to low availability impact on PREEMPT_RT configurations.

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 10kernelFix deferred
Red Hat Enterprise Linux 6kernelNot affected
Red Hat Enterprise Linux 7kernelOut of support scope
Red Hat Enterprise Linux 7kernel-rtOut of support scope
Red Hat Enterprise Linux 8kernelNot affected
Red Hat Enterprise Linux 8kernel-rtNot affected
Red Hat Enterprise Linux 9kernelFix deferred
Red Hat Enterprise Linux 9kernel-rtFix deferred

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-21825.

References

Check your stackJSON