nday
CVE-2022-50067

btrfs: unset reloc control if transaction commit fails in prepare_to_relocate()

Linux / Linux

に公開されました。nday はまだ修正の根拠を取得していません。修正がないという意味ではありません。4 つの PoC ソースのいずれにも未掲載です。CISA KEV には現時点で未掲載です。

tags weakness typeuse-after-free accesslocalno user interaction productLinux kernel product typeoperating system
why these tags

nday derives these tags by fixed rules from the facts below; NVD, the CNA and other sources do not assign them. Vocabulary and rules: ~/tags.

use-after-free
CWE-416, stated by NVD's analysts
local
AV:L in CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (CVSS 3.1) from NVD's analysts
no user interaction
UI:N in CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (CVSS 3.1) from NVD's analysts
Linux kernel
affected products in the CVE record: Linux · LinuxCPE names NVD's analysts give as vulnerable: o:linux:linux_kernel
operating system
affected products in the CVE record: Linux · LinuxCPE names NVD's analysts give as vulnerable: o:linux:linux_kernelthe product type of Linux kernel in nday's product registry
現在の段階
DIS
公開日時
CVSS 基本値
スコアなし

ライフサイクル

横軸は UTC。点=分単位、幅広の帯=日付のみ、白抜き=不明または推定。
日時不明
DIS公開
2025-06-18T11:02Z
PAT修正
記録なし
ANA解析
記録なし
POCPoC
記録なし
ITW悪用
記録なし
KEVKEV
記録なし

概要

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

btrfs: unset reloc control if transaction commit fails in prepare_to_relocate()

In btrfs_relocate_block_group(), the rc is allocated. Then btrfs_relocate_block_group() calls

relocate_block_group()
  prepare_to_relocate()
    set_reloc_control()

that assigns rc to the variable fs_info->reloc_ctl. When prepare_to_relocate() returns, it calls

btrfs_commit_transaction()
  btrfs_start_dirty_block_groups()
    btrfs_alloc_path()
      kmem_cache_zalloc()

which may fail for example (or other errors could happen). When the failure occurs, btrfs_relocate_block_group() detects the error and frees rc and doesn't set fs_info->reloc_ctl to NULL. After that, in btrfs_init_reloc_root(), rc is retrieved from fs_info->reloc_ctl and then used, which may cause a use-after-free bug.

This possible bug can be triggered by calling btrfs_ioctl_balance() before calling btrfs_ioctl_defrag().

To fix this possible bug, in prepare_to_relocate(), check if btrfs_commit_transaction() fails. If the failure occurs, unset_reloc_control() is called to set fs_info->reloc_ctl to NULL.

The error log in our fault-injection testing is shown as follows:

[   58.751070] BUG: KASAN: use-after-free in btrfs_init_reloc_root+0x7ca/0x920 [btrfs]
...
[   58.753577] Call Trace:
...
[   58.755800]  kasan_report+0x45/0x60
[   58.756066]  btrfs_init_reloc_root+0x7ca/0x920 [btrfs]
[   58.757304]  record_root_in_trans+0x792/0xa10 [btrfs]
[   58.757748]  btrfs_record_root_in_trans+0x463/0x4f0 [btrfs]
[   58.758231]  start_transaction+0x896/0x2950 [btrfs]
[   58.758661]  btrfs_defrag_root+0x250/0xc00 [btrfs]
[   58.759083]  btrfs_ioctl_defrag+0x467/0xa00 [btrfs]
[   58.759513]  btrfs_ioctl+0x3c95/0x114e0 [btrfs]
...
[   58.768510] Allocated by task 23683:
[   58.768777]  ____kasan_kmalloc+0xb5/0xf0
[   58.769069]  __kmalloc+0x227/0x3d0
[   58.769325]  alloc_reloc_control+0x10a/0x3d0 [btrfs]
[   58.769755]  btrfs_relocate_block_group+0x7aa/0x1e20 [btrfs]
[   58.770228]  btrfs_relocate_chunk+0xf1/0x760 [btrfs]
[   58.770655]  __btrfs_balance+0x1326/0x1f10 [btrfs]
[   58.771071]  btrfs_balance+0x3150/0x3d30 [btrfs]
[   58.771472]  btrfs_ioctl_balance+0xd84/0x1410 [btrfs]
[   58.771902]  btrfs_ioctl+0x4caa/0x114e0 [btrfs]
...
[   58.773337] Freed by task 23683:
...
[   58.774815]  kfree+0xda/0x2b0
[   58.775038]  free_reloc_control+0x1d6/0x220 [btrfs]
[   58.775465]  btrfs_relocate_block_group+0x115c/0x1e20 [btrfs]
[   58.775944]  btrfs_relocate_chunk+0xf1/0x760 [btrfs]
[   58.776369]  __btrfs_balance+0x1326/0x1f10 [btrfs]
[   58.776784]  btrfs_balance+0x3150/0x3d30 [btrfs]
[   58.777185]  btrfs_ioctl_balance+0xd84/0x1410 [btrfs]
[   58.777621]  btrfs_ioctl+0x4caa/0x114e0 [btrfs]
...

Original text of the CVE record (cvelist), shown as published.

イベント履歴

+DIS公開

Linux が CVE レコードを公開。

出典 cvelist · nday が に一括取り込み · 生データ
{
  "id": 279408,
  "type": "disclosed",
  "source": "cvelist",
  "url": "https://www.cve.org/CVERecord?id=CVE-2022-50067",
  "occurred_at": "2025-06-18T11:02:13.127Z",
  "observed_at": "2026-11-13T05:37:51.196939Z",
  "is_backfill": true,
  "dedupe_key": "",
  "detail": {
    "state": "PUBLISHED",
    "date_published": "2025-06-18T11:02:13.127Z",
    "assigner_short_name": "Linux"
  }
}

Report an error

report an error or omission

Something on this page wrong or missing? Tell the editors; if they accept it, this page's revision log says so publicly. Upstream data is not changed.

研究者の投稿

過去 7 日間に 0 人の研究者が言及

リストの研究者が X でこの CVE に触れた投稿です。原文のまま表示し、nday は検証していません。

リストの研究者が X でこの CVE に触れた投稿は、まだ収集していません。

Discussion

0 comments

No comments yet.