nday
CVE-2025-21942

btrfs: zoned: fix extent range end unlock in cow_file_range()

Linux / Linux

披露于 。本站尚未获取修复依据,不能据此认为没有补丁。四个 PoC 来源都还没有收录。尚未列入 CISA KEV。

标签 漏洞类型resource exhaustion 攻击途径本地无需用户交互 产品Linux kernel 产品类型操作系统
这些标签的依据

这些标签由 nday 按固定规则从下列事实自动推导,不是 NVD、编号分配方或其他来源给出的。全部标签和规则见 ~/tags。

resource exhaustion
CWE-835(来源:NVD 分析人员)
本地
NVD 分析人员 给出的 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H(CVSS 3.1)中的 AV:L
无需用户交互
NVD 分析人员 给出的 CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H(CVSS 3.1)中的 UI:N
Linux kernel
CVE 记录列出的受影响产品:Linux · LinuxNVD 分析人员标为易受攻击的 CPE 名称:o:linux:linux_kernel
操作系统
CVE 记录列出的受影响产品:Linux · LinuxNVD 分析人员标为易受攻击的 CPE 名称:o:linux:linux_kernelnday 产品登记表中 Linux kernel 的产品类型
当前阶段
DIS
披露
CVSS
暂无评分

生命周期

横轴 UTC;点=精确到分钟,宽条=仅日期,空心=未知或推定。
时间未知
DIS披露
2025-04-01T15:41Z
PAT补丁
尚无记录
ANA分析
尚无记录
POCPoC
尚无记录
ITW在野
尚无记录
KEVKEV
尚无记录

摘要

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

btrfs: zoned: fix extent range end unlock in cow_file_range()

Running generic/751 on the for-next branch often results in a hang like below. They are both stack by locking an extent. This suggests someone forget to unlock an extent.

INFO: task kworker/u128:1:12 blocked for more than 323 seconds.
      Not tainted 6.13.0-BTRFS-ZNS+ #503
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:kworker/u128:1  state:D stack:0     pid:12    tgid:12    ppid:2      flags:0x00004000
Workqueue: btrfs-fixup btrfs_work_helper [btrfs]
Call Trace:
 <TASK>
 __schedule+0x534/0xdd0
 schedule+0x39/0x140
 __lock_extent+0x31b/0x380 [btrfs]
 ? __pfx_autoremove_wake_function+0x10/0x10
 btrfs_writepage_fixup_worker+0xf1/0x3a0 [btrfs]
 btrfs_work_helper+0xff/0x480 [btrfs]
 ? lock_release+0x178/0x2c0
 process_one_work+0x1ee/0x570
 ? srso_return_thunk+0x5/0x5f
 worker_thread+0x1d1/0x3b0
 ? __pfx_worker_thread+0x10/0x10
 kthread+0x10b/0x230
 ? __pfx_kthread+0x10/0x10
 ret_from_fork+0x30/0x50
 ? __pfx_kthread+0x10/0x10
 ret_from_fork_asm+0x1a/0x30
 </TASK>
INFO: task kworker/u134:0:184 blocked for more than 323 seconds.
      Not tainted 6.13.0-BTRFS-ZNS+ #503
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:kworker/u134:0  state:D stack:0     pid:184   tgid:184   ppid:2      flags:0x00004000
Workqueue: writeback wb_workfn (flush-btrfs-4)
Call Trace:
 <TASK>
 __schedule+0x534/0xdd0
 schedule+0x39/0x140
 __lock_extent+0x31b/0x380 [btrfs]
 ? __pfx_autoremove_wake_function+0x10/0x10
 find_lock_delalloc_range+0xdb/0x260 [btrfs]
 writepage_delalloc+0x12f/0x500 [btrfs]
 ? srso_return_thunk+0x5/0x5f
 extent_write_cache_pages+0x232/0x840 [btrfs]
 btrfs_writepages+0x72/0x130 [btrfs]
 do_writepages+0xe7/0x260
 ? srso_return_thunk+0x5/0x5f
 ? lock_acquire+0xd2/0x300
 ? srso_return_thunk+0x5/0x5f
 ? find_held_lock+0x2b/0x80
 ? wbc_attach_and_unlock_inode.part.0+0x102/0x250
 ? wbc_attach_and_unlock_inode.part.0+0x102/0x250
 __writeback_single_inode+0x5c/0x4b0
 writeback_sb_inodes+0x22d/0x550
 __writeback_inodes_wb+0x4c/0xe0
 wb_writeback+0x2f6/0x3f0
 wb_workfn+0x32a/0x510
 process_one_work+0x1ee/0x570
 ? srso_return_thunk+0x5/0x5f
 worker_thread+0x1d1/0x3b0
 ? __pfx_worker_thread+0x10/0x10
 kthread+0x10b/0x230
 ? __pfx_kthread+0x10/0x10
 ret_from_fork+0x30/0x50
 ? __pfx_kthread+0x10/0x10
 ret_from_fork_asm+0x1a/0x30
 </TASK>

This happens because we have another success path for the zoned mode. When there is no active zone available, btrfs_reserve_extent() returns -EAGAIN. In this case, we have two reactions.

(1) If the given range is never allocated, we can only wait for someone to finish a zone, so wait on BTRFS_FS_NEED_ZONE_FINISH bit and retry afterward.

(2) Or, if some allocations are already done, we must bail out and let the caller to send IOs for the allocation. This is because these IOs may be necessary to finish a zone.

The commit 06f364284794 ("btrfs: do proper folio cleanup when cow_file_range() failed") moved the unlock code from the inside of the loop to the outside. So, previously, the allocated extents are unlocked just after the allocation and so before returning from the function. However, they are no longer unlocked on the case (2) above. That caused the hang issue.

Fix the issue by modifying the 'end' to the end of the allocated range. Then, we can exit the loop and the same unlock code can properly handle the case.

以上是 CVE 记录(cvelist)中的原文,未经改写。

事件记录

+DIS披露

CVE 记录发布,编号分配方是 Linux。

来源 cvelist · 本站 批量导入 · 原始记录
{
  "id": 364436,
  "type": "disclosed",
  "source": "cvelist",
  "url": "https://www.cve.org/CVERecord?id=CVE-2025-21942",
  "occurred_at": "2025-04-01T15:41:06.977Z",
  "observed_at": "2026-11-13T05:38:58.580971Z",
  "is_backfill": true,
  "dedupe_key": "",
  "detail": {
    "state": "PUBLISHED",
    "date_published": "2025-04-01T15:41:06.977Z",
    "assigner_short_name": "Linux"
  }
}

纠错

报告错误或缺失

页面有误或缺失?告诉编辑;采纳后在本页修订记录公开说明,上游数据不会被改动。

研究员讨论

近 7 天有 0 位研究员提到

研究员在 X 上提到此 CVE 的帖子,原文照录,nday 不核实。

尚未采集到名单内研究员在 X 上提到此 CVE 的帖子。

讨论

0 条评论

还没有评论。