CVE-2025-21753

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-21753
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-21753.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-21753
Downstream
Related
Published
2025-02-27T02:12:23.235Z
Modified
2025-11-27T02:33:37.827414Z
Severity
  • 7.8 (High) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H CVSS Calculator
Summary
btrfs: fix use-after-free when attempting to join an aborted transaction
Details

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

btrfs: fix use-after-free when attempting to join an aborted transaction

When we are trying to join the current transaction and if it's aborted, we read its 'aborted' field after unlocking fsinfo->translock and without holding any extra reference count on it. This means that a concurrent task that is aborting the transaction may free the transaction before we read its 'aborted' field, leading to a use-after-free.

Fix this by reading the 'aborted' field while holding fsinfo->translock since any freeing task must first acquire that lock and set fsinfo->runningtransaction to NULL before freeing the transaction.

This was reported by syzbot and Dmitry with the following stack traces from KASAN:

================================================================== BUG: KASAN: slab-use-after-free in join_transaction+0xd9b/0xda0 fs/btrfs/transaction.c:278 Read of size 4 at addr ffff888011839024 by task kworker/u4:9/1128

CPU: 0 UID: 0 PID: 1128 Comm: kworker/u4:9 Not tainted 6.13.0-rc7-syzkaller-00019-gc45323b7560e #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: eventsunbound btrfsasyncreclaimdataspace Call Trace: <TASK> _dumpstack lib/dumpstack.c:94 [inline] dumpstacklvl+0x241/0x360 lib/dumpstack.c:120 printaddressdescription mm/kasan/report.c:378 [inline] printreport+0x169/0x550 mm/kasan/report.c:489 kasanreport+0x143/0x180 mm/kasan/report.c:602 jointransaction+0xd9b/0xda0 fs/btrfs/transaction.c:278 starttransaction+0xaf8/0x1670 fs/btrfs/transaction.c:697 flushspace+0x448/0xcf0 fs/btrfs/space-info.c:803 btrfsasyncreclaimdataspace+0x159/0x510 fs/btrfs/space-info.c:1321 processonework kernel/workqueue.c:3236 [inline] processscheduledworks+0xa66/0x1840 kernel/workqueue.c:3317 workerthread+0x870/0xd30 kernel/workqueue.c:3398 kthread+0x2f0/0x390 kernel/kthread.c:389 retfromfork+0x4b/0x80 arch/x86/kernel/process.c:147 retfromforkasm+0x1a/0x30 arch/x86/entry/entry_64.S:244 </TASK>

Allocated by task 5315: kasansavestack mm/kasan/common.c:47 [inline] kasansavetrack+0x3f/0x80 mm/kasan/common.c:68 poisonkmallocredzone mm/kasan/common.c:377 [inline] _kasankmalloc+0x98/0xb0 mm/kasan/common.c:394 kasankmalloc include/linux/kasan.h:260 [inline] _kmalloccachenoprof+0x243/0x390 mm/slub.c:4329 kmallocnoprof include/linux/slab.h:901 [inline] jointransaction+0x144/0xda0 fs/btrfs/transaction.c:308 starttransaction+0xaf8/0x1670 fs/btrfs/transaction.c:697 btrfscreatecommon+0x1b2/0x2e0 fs/btrfs/inode.c:6572 lookupopen fs/namei.c:3649 [inline] openlastlookups fs/namei.c:3748 [inline] pathopenat+0x1c03/0x3590 fs/namei.c:3984 dofilpopen+0x27f/0x4e0 fs/namei.c:4014 dosysopenat2+0x13e/0x1d0 fs/open.c:1402 dosysopen fs/open.c:1417 [inline] _dosyscreat fs/open.c:1495 [inline] _sesyscreat fs/open.c:1489 [inline] _x64syscreat+0x123/0x170 fs/open.c:1489 dosyscallx64 arch/x86/entry/common.c:52 [inline] dosyscall64+0xf3/0x230 arch/x86/entry/common.c:83 entrySYSCALL64afterhwframe+0x77/0x7f

Freed by task 5336: kasansavestack mm/kasan/common.c:47 [inline] kasansavetrack+0x3f/0x80 mm/kasan/common.c:68 kasansavefreeinfo+0x40/0x50 mm/kasan/generic.c:582 poisonslabobject mm/kasan/common.c:247 [inline] _kasanslabfree+0x59/0x70 mm/kasan/common.c:264 kasanslabfree include/linux/kasan.h:233 [inline] slabfreehook mm/slub.c:2353 [inline] slabfree mm/slub.c:4613 [inline] kfree+0x196/0x430 mm/slub.c:4761 cleanuptransaction fs/btrfs/transaction.c:2063 [inline] btrfscommittransaction+0x2c97/0x3720 fs/btrfs/transaction.c:2598 insertbalanceitem+0x1284/0x20b0 fs/btrfs/volumes.c:3757 btrfs_balance+0x992/ ---truncated---

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/blob/cc431b3424123d84bcd7afd4de150b33f117a8ef/cves/2025/21xxx/CVE-2025-21753.json"
}
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
871383be592ba7e819d27556591e315a0df38cee
Fixed
cee55b1219568c80bf0d5dc55066e4a859baf753
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
c7a53757717e68af94a56929d57f1e6daff220ec
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
7e954b6bb95d67ae4d1a20e9cfd83c182cf929bc
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
6ba4663ada6c6315af23a6669d386146634808ec
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
8f5cff471039caa2b088060c074c2bf2081bcb01
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
86d71a026a7f63da905db9add845c8ee88801eca
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
ce628048390dad80320d5a1f74de6ca1e1be91e7
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
871383be592ba7e819d27556591e315a0df38cee
Fixed
e2f0943cf37305dbdeaf9846e3c941451bcdef63

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.4.0
Fixed
5.4.291
Type
ECOSYSTEM
Events
Introduced
5.5.0
Fixed
5.10.235
Type
ECOSYSTEM
Events
Introduced
5.11.0
Fixed
5.15.179
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
6.1.129
Type
ECOSYSTEM
Events
Introduced
6.2.0
Fixed
6.6.78
Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.12.14
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.13.3