HomeDefectsLIN1025-1885
Acknowledged

LIN1025-1885 : Security Advisory - linux - CVE-2022-50067

Created: Jun 18, 2025    Updated: Sep 4, 2026
Resolved Date: Jun 19, 2025
Found In Version: 10.25.33.1
Severity: Standard
Applicable for: Wind River Linux LTS 25
Component/s: Kernel

Description

In the Linux kernel, the following vulnerability has been resolved:EOL][EOL]btrfs: unset reloc control if transaction commit fails in prepare_to_relocate()[EOL][EOL]In btrfs_relocate_block_group(), the rc is allocated.  Then[EOL]btrfs_relocate_block_group() calls[EOL][EOL]relocate_block_group()[EOL]  prepare_to_relocate()[EOL]    set_reloc_control()[EOL][EOL]that assigns rc to the variable fs_info->reloc_ctl. When[EOL]prepare_to_relocate() returns, it calls[EOL][EOL]btrfs_commit_transaction()[EOL]  btrfs_start_dirty_block_groups()[EOL]    btrfs_alloc_path()[EOL]      kmem_cache_zalloc()[EOL][EOL]which may fail for example (or other errors could happen). When the[EOL]failure occurs, btrfs_relocate_block_group() detects the error and frees[EOL]rc and doesn't set fs_info->reloc_ctl to NULL. After that, in[EOL]btrfs_init_reloc_root(), rc is retrieved from fs_info->reloc_ctl and[EOL]then used, which may cause a use-after-free bug.[EOL][EOL]This possible bug can be triggered by calling btrfs_ioctl_balance()[EOL]before calling btrfs_ioctl_defrag().[EOL][EOL]To fix this possible bug, in prepare_to_relocate(), check if[EOL]btrfs_commit_transaction() fails. If the failure occurs,[EOL]unset_reloc_control() is called to set fs_info->reloc_ctl to NULL.[EOL][EOL]The error log in our fault-injection testing is shown as follows:[EOL][EOL]  [   58.751070] BUG: KASAN: use-after-free in btrfs_init_reloc_root+0x7ca/0x920 [btrfs][EOL]  ...[EOL]  [   58.753577] Call Trace:[EOL]  ...[EOL]  [   58.755800]  kasan_report+0x45/0x60[EOL]  [   58.756066]  btrfs_init_reloc_root+0x7ca/0x920 [btrfs][EOL]  [   58.757304]  record_root_in_trans+0x792/0xa10 [btrfs][EOL]  [   58.757748]  btrfs_record_root_in_trans+0x463/0x4f0 [btrfs][EOL]  [   58.758231]  start_transaction+0x896/0x2950 [btrfs][EOL]  [   58.758661]  btrfs_defrag_root+0x250/0xc00 [btrfs][EOL]  [   58.759083]  btrfs_ioctl_defrag+0x467/0xa00 [btrfs][EOL]  [   58.759513]  btrfs_ioctl+0x3c95/0x114e0 [btrfs][EOL]  ...[EOL]  [   58.768510] Allocated by task 23683:[EOL]  [   58.768777]  ____kasan_kmalloc+0xb5/0xf0[EOL]  [   58.769069]  __kmalloc+0x227/0x3d0[EOL]  [   58.769325]  alloc_reloc_control+0x10a/0x3d0 [btrfs][EOL]  [   58.769755]  btrfs_relocate_block_group+0x7aa/0x1e20 [btrfs][EOL]  [   58.770228]  btrfs_relocate_chunk+0xf1/0x760 [btrfs][EOL]  [   58.770655]  __btrfs_balance+0x1326/0x1f10 [btrfs][EOL]  [   58.771071]  btrfs_balance+0x3150/0x3d30 [btrfs][EOL]  [   58.771472]  btrfs_ioctl_balance+0xd84/0x1410 [btrfs][EOL]  [   58.771902]  btrfs_ioctl+0x4caa/0x114e0 [btrfs][EOL]  ...[EOL]  [   58.773337] Freed by task 23683:[EOL]  ...[EOL]  [   58.774815]  kfree+0xda/0x2b0[EOL]  [   58.775038]  free_reloc_control+0x1d6/0x220 [btrfs][EOL]  [   58.775465]  btrfs_relocate_block_group+0x115c/0x1e20 [btrfs][EOL]  [   58.775944]  btrfs_relocate_chunk+0xf1/0x760 [btrfs][EOL]  [   58.776369]  __btrfs_balance+0x1326/0x1f10 [btrfs][EOL]  [   58.776784]  btrfs_balance+0x3150/0x3d30 [btrfs][EOL]  [   58.777185]  btrfs_ioctl_balance+0xd84/0x1410 [btrfs][EOL]  [   58.777621]  btrfs_ioctl+0x4caa/0x114e0 [btrfs][EOL]  ...

CREATE(Triage):(User=lchen-cn) [CVE-2022-50067 (https://nvd.nist.gov/vuln/detail/CVE-2022-50067)