btrfs: fix use-after-free when attempting to join an aborted transaction
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 fs_info->trans_lock 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 fs_info->trans_lock since any freeing task must first acquire that lock and set fs_info->running_transaction 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: events_unbound btrfs_async_reclaim_data_space Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c
CVE-2025-21753
Primary source · Revision 1
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: cve:CVE-2025-21753
Linux
Source reference: /containers/cna/affected/0/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Linux
Source reference: /containers/cna/affected/1/product
- Affected versions
- Not stated in this record
- Fixed versions
- Not stated in this record
- Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "cee55b1219568c80bf0d5dc55066e4a859baf753",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "c7a53757717e68af94a56929d57f1e6daff220ec",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "7e954b6bb95d67ae4d1a20e9cfd83c182cf929bc",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "6ba4663ada6c6315af23a6669d386146634808ec",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "8f5cff471039caa2b088060c074c2bf2081bcb01",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "86d71a026a7f63da905db9add845c8ee88801eca",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "ce628048390dad80320d5a1f74de6ca1e1be91e7",
"versionType": "git"
},
{
"status": "affected",
"version": "871383be592ba7e819d27556591e315a0df38cee",
"lessThan": "e2f0943cf37305dbdeaf9846e3c941451bcdef63",
"versionType": "git"
}
],
"programFiles": [
"fs/btrfs/transaction.c"
],
"defaultStatus": "unaffected"
},
{
"repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
"vendor": "Linux",
"product": "Linux",
"versions": [
{
"status": "affected",
"version": "3.4"
},
{
"status": "unaffected",
"version": "0",
"lessThan": "3.4",
"versionType": "semver"
},
{
"status": "unaffected",
"version": "5.4.291",
"versionType": "semver",
"lessThanOrEqual": "5.4.*"
},
{
"status": "unaffected",
"version": "5.10.235",
"versionType": "semver",
"lessThanOrEqual": "5.10.*"
},
{
"status": "unaffected",
"version": "5.15.179",
"versionType": "semver",
"lessThanOrEqual": "5.15.*"
},
{
"status": "unaffected",
"version": "6.1.129",
"versionType": "semver",
"lessThanOrEqual": "6.1.*"
},
{
"status": "unaffected",
"version": "6.6.78",
"versionType": "semver",
"lessThanOrEqual": "6.6.*"
},
{
"status": "unaffected",
"version": "6.12.14",
"versionType": "semver",
"lessThanOrEqual": "6.12.*"
},
{
"status": "unaffected",
"version": "6.13.3",
"versionType": "semver",
"lessThanOrEqual": "6.13.*"
},
{
"status": "unaffected",
"version": "6.14",
"versionType": "original_commit_for_fix",
"lessThanOrEqual": "*"
}
],
"programFiles": [
"fs/btrfs/transaction.c"
],
"defaultStatus": "affected"
}
]- Related CVEs
- CVE-2025-21753
Source reference:
/cveMetadata/cveId
Publisher severity
high
Source reference: /containers/cna/metrics
- Event
- #26931 · Revision 1
- Added to Heist Feed
- Publisher date