Skip to content
OpenAdvisories
High · 7.8 CVE-2022-50432 EUVD-2025-32838GHSA-pr4f-7xjv-67x4

kernfs: fix use-after-free in __kernfs_remove

Published Oct 1, 2025 · Updated Oct 15, 2026 · Assigned by Linux

Vendor: Linux Product: Linux Package: linux Package: linux-allwinner-5.19 Package: linux-aws-5.0 Package: linux-aws-5.11 Package: linux-aws-5.13 Package: linux-aws-5.19 Package: linux-aws-5.3 Package: linux-aws-5.8 Package: linux-aws-6.2 Package: linux-aws-6.5 Package: linux-azure Package: linux-azure-5.11 Package: linux-azure-5.13 Package: linux-azure-5.19 Package: linux-azure-5.3 Package: linux-azure-5.8 Package: linux-azure-6.11 Package: linux-azure-6.2 Package: linux-azure-6.5 Package: linux-azure-edge Package: linux-azure-fde Package: linux-azure-fde-5.19 Package: linux-azure-fde-6.2 Package: linux-gcp Package: linux-gcp-5.11 Package: linux-gcp-5.13 Package: linux-gcp-5.19 Package: linux-gcp-5.3 Package: linux-gcp-5.8 Package: linux-gcp-6.11 Package: linux-gcp-6.2 Package: linux-gcp-6.5 Package: linux-gke Package: linux-gke-4.15 Package: linux-gke-5.15 Package: linux-gke-5.4 Package: linux-gkeop Package: linux-gkeop-5.15 Package: linux-gkeop-5.4 Package: linux-hwe Package: linux-hwe-5.11 Package: linux-hwe-5.13 Package: linux-hwe-5.19 Package: linux-hwe-5.8 Package: linux-hwe-6.11 Package: linux-hwe-6.2 Package: linux-hwe-6.5 Package: linux-hwe-edge Package: linux-intel Package: linux-intel-5.13 Package: linux-intel-iot-realtime Package: linux-lowlatency-hwe-5.19 Package: linux-lowlatency-hwe-6.11 Package: linux-lowlatency-hwe-6.2 Package: linux-lowlatency-hwe-6.5 Package: linux-nvidia-6.2 Package: linux-nvidia-6.5 Package: linux-oem Package: linux-oem-5.10 Package: linux-oem-5.13 Package: linux-oem-5.14 Package: linux-oem-5.17 Package: linux-oem-5.6 Package: linux-oem-6.0 Package: linux-oem-6.1 Package: linux-oem-6.11 Package: linux-oem-6.5 Package: linux-oem-6.8 Package: linux-oracle-5.0 Package: linux-oracle-5.11 Package: linux-oracle-5.13 Package: linux-oracle-5.3 Package: linux-oracle-5.8 Package: linux-oracle-6.5 Package: linux-raspi-realtime Package: linux-raspi2 Package: linux-realtime Package: linux-riscv Package: linux-riscv-5.11 Package: linux-riscv-5.19 Package: linux-riscv-5.8 Package: linux-riscv-6.5 Package: linux-starfive-5.19 Package: linux-starfive-6.2 Package: linux-starfive-6.5 Platform: Linux Ecosystem: Debian Ecosystem: Ubuntu

Description

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

kernfs: fix use-after-free in __kernfs_remove

Syzkaller managed to trigger concurrent calls to
kernfs_remove_by_name_ns() for the same file resulting in
a KASAN detected use-after-free. The race occurs when the root
node is freed during kernfs_drain().

To prevent this acquire an additional reference for the root
of the tree that is removed before calling __kernfs_remove().

Found by syzkaller with the following reproducer (slab_nomerge is
required):

syz_mount_image$ext4(0x0, &(0x7f0000000100)='./file0\x00', 0x100000, 0x0, 0x0, 0x0, 0x0)
r0 = openat(0xffffffffffffff9c, &(0x7f0000000080)='/proc/self/exe\x00', 0x0, 0x0)
close(r0)
pipe2(&(0x7f0000000140)={0xffffffffffffffff, <r1=>0xffffffffffffffff}, 0x800)
mount$9p_fd(0x0, &(0x7f0000000040)='./file0\x00', &(0x7f00000000c0), 0x408, &(0x7f0000000280)={'trans=fd,', {'rfdno', 0x3d, r0}, 0x2c, {'wfdno', 0x3d, r1}, 0x2c, {[{@cache_loose}, {@mmap}, {@loose}, {@loose}, {@mmap}], [{@mask={'mask', 0x3d, '^MAY_EXEC'}}, {@fsmagic={'fsmagic', 0x3d, 0x10001}}, {@dont_hash}]}})

Sample report:

==================================================================
BUG: KASAN: use-after-free in kernfs_type include/linux/kernfs.h:335 [inline]
BUG: KASAN: use-after-free in kernfs_leftmost_descendant fs/kernfs/dir.c:1261 [inline]
BUG: KASAN: use-after-free in __kernfs_remove.part.0+0x843/0x960 fs/kernfs/dir.c:1369
Read of size 2 at addr ffff8880088807f0 by task syz-executor.2/857

CPU: 0 PID: 857 Comm: syz-executor.2 Not tainted 6.0.0-rc3-00363-g7726d4c3e60b #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x6e/0x91 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:317 [inline]
print_report.cold+0x5e/0x5e5 mm/kasan/report.c:433
kasan_report+0xa3/0x130 mm/kasan/report.c:495
kernfs_type include/linux/kernfs.h:335 [inline]
kernfs_leftmost_descendant fs/kernfs/dir.c:1261 [inline]
__kernfs_remove.part.0+0x843/0x960 fs/kernfs/dir.c:1369
__kernfs_remove fs/kernfs/dir.c:1356 [inline]
kernfs_remove_by_name_ns+0x108/0x190 fs/kernfs/dir.c:1589
sysfs_slab_add+0x133/0x1e0 mm/slub.c:5943
__kmem_cache_create+0x3e0/0x550 mm/slub.c:4899
create_cache mm/slab_common.c:229 [inline]
kmem_cache_create_usercopy+0x167/0x2a0 mm/slab_common.c:335
p9_client_create+0xd4d/0x1190 net/9p/client.c:993
v9fs_session_init+0x1e6/0x13c0 fs/9p/v9fs.c:408
v9fs_mount+0xb9/0xbd0 fs/9p/vfs_super.c:126
legacy_get_tree+0xf1/0x200 fs/fs_context.c:610
vfs_get_tree+0x85/0x2e0 fs/super.c:1530
do_new_mount fs/namespace.c:3040 [inline]
path_mount+0x675/0x1d00 fs/namespace.c:3370
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__x64_sys_mount+0x282/0x300 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f725f983aed
Code: 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f725f0f7028 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f725faa3f80 RCX: 00007f725f983aed
RDX: 00000000200000c0 RSI: 0000000020000040 RDI: 0000000000000000
RBP: 00007f725f9f419c R08: 0000000020000280 R09: 0000000000000000
R10: 0000000000000408 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000006 R14: 00007f725faa3f80 R15: 00007f725f0d7000
</TASK>

Allocated by task 855:
kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:437 [inline]
__kasan_slab_alloc+0x66/0x80 mm/kasan/common.c:470
kasan_slab_alloc include/linux/kasan.h:224 [inline]
slab_post_alloc_hook mm/slab.h:7
---truncated---

Affected products

VendorProductAffectedFixed
Linux Linux 3.14 4.9.332

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 linux 6.0.7-1 —
Debian 13 linux 6.0.7-1 —
Debian 12 linux 6.0.7-1 —
ReleasePackageFixed inAdvisory
Ubuntu 24.04 LTS linux-intel +9 No fix yet —
Ubuntu 22.04 LTS linux-riscv +32 No fix yet —
Ubuntu 20.04 LTS linux-gke +28 No fix yet —
Ubuntu 18.04 LTS linux-gcp +14 No fix yet —
Ubuntu 16.04 LTS linux-hwe-edge No fix yet —
ReleasePackageFixed inAdvisory
SLES 15 SP5 kernel-64kb +6 5.14.21-150500.55.124.1 SUSE-SU-2025:03615-1
SLES 15 SP5 kernel-default-base 5.14.21-150500.55.124.1.150500.6.59.1 SUSE-SU-2025:03615-1
SLES 15 SP4 kernel-64kb +6 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SLES 15 SP4 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SLES 15 SP3 kernel-64kb +5 5.3.18-150300.59.226.2 SUSE-SU-2025:4188-1
SLES 15 SP3 kernel-default-base 5.3.18-150300.59.226.2.150300.18.134.2 SUSE-SU-2025:4188-1
SLES 15 SP3 kernel-docs 5.3.18-150300.59.226.3 SUSE-SU-2025:4188-1
SLES 15 SP3 kernel-syms 5.3.18-150300.59.226.1 SUSE-SU-2025:4188-1
SLES 12 SP5 kernel-syms +2 4.12.14-122.275.1 SUSE-SU-2025:03614-1
Show 17 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SLES for SAP 15 SP5 kernel-default-base 5.14.21-150500.55.124.1.150500.6.59.1 SUSE-SU-2025:03615-1
SLES for SAP 15 SP5 kernel-docs +4 5.14.21-150500.55.124.1 SUSE-SU-2025:03615-1
SLES for SAP 15 SP4 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SLES for SAP 15 SP4 kernel-docs +4 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SLES for SAP 15 SP3 kernel-default-base 5.3.18-150300.59.226.2.150300.18.134.2 SUSE-SU-2025:4188-1
SLES for SAP 15 SP3 kernel-docs 5.3.18-150300.59.226.3 SUSE-SU-2025:4188-1
SLES for SAP 15 SP3 kernel-source +3 5.3.18-150300.59.226.2 SUSE-SU-2025:4188-1
SLES for SAP 15 SP3 kernel-syms 5.3.18-150300.59.226.1 SUSE-SU-2025:4188-1
SLE Micro 5.5 kernel-default-base 5.14.21-150500.55.124.1.150500.6.59.1 SUSE-SU-2025:03615-1
SLE Micro 5.5 kernel-rt +1 5.14.21-150500.13.109.1 SUSE-SU-2025:3761-1
SLE Micro 5.5 kernel-source +1 5.14.21-150500.55.124.1 SUSE-SU-2025:03615-1
SLE Micro 5.4 kernel-default 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SLE Micro 5.4 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SLE Micro 5.4 kernel-rt +1 5.14.21-150400.15.133.1 SUSE-SU-2025:3716-1
SLE Micro 5.3 kernel-default 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SLE Micro 5.3 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SLE Micro 5.3 kernel-rt +1 5.14.21-150400.15.133.1 SUSE-SU-2025:3716-1
SLE Micro 5.2 kernel-default 5.3.18-150300.59.226.2 SUSE-SU-2025:4188-1
SLE Micro 5.2 kernel-default-base 5.3.18-150300.59.226.2.150300.18.134.2 SUSE-SU-2025:4188-1
SLE Micro 5.2 kernel-rt +1 5.3.18-150300.226.1 SUSE-SU-2025:4135-1
SLE Live Patching 15 SP5 kernel-default 5.14.21-150500.55.124.1 SUSE-SU-2025:03615-1
SLE Live Patching 15 SP5 kernel-livepatch-SLE15-SP5_Update_31 1-150500.11.3.1 SUSE-SU-2025:03615-1
SLE Live Patching 15 SP4 kernel-default 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SLE Live Patching 15 SP4 kernel-livepatch-SLE15-SP4_Update_45 1-150400.9.3.1 SUSE-SU-2025:03628-1
SLE Live Patching 15 SP3 kernel-default 5.3.18-150300.59.226.2 SUSE-SU-2025:4188-1
SLE Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_50 18-150300.2.1 SUSE-SU-2025:4203-1
SLE Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_51 16-150300.2.1 SUSE-SU-2025:4171-1
SLE Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_59 9-150300.2.1 SUSE-SU-2025:4213-1
SLE Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_60 6-150300.2.1 SUSE-SU-2025:4172-1
SLE Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_62 2-150300.2.1 SUSE-SU-2025:4285-1
SLE Live Patching 15 SP3 kernel-livepatch-SLE15-SP3_Update_63 1-150300.7.5.2 SUSE-SU-2025:4188-1
SLE Live Patching 12 SP5 kernel-default 4.12.14-122.275.1 SUSE-SU-2025:03614-1
SLE Live Patching 12 SP5 kgraft-patch-SLE12-SP5_Update_73 1-8.3.1 SUSE-SU-2025:03614-1
SLE HPC 15 SP5 kernel-64kb +5 5.14.21-150500.55.124.1 SUSE-SU-2025:03615-1
SLE HPC 15 SP5 kernel-default-base 5.14.21-150500.55.124.1.150500.6.59.1 SUSE-SU-2025:03615-1
SLE HPC 15 SP4 kernel-64kb +5 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SLE HPC 15 SP4 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SLE HPC 15 SP3 kernel-64kb +4 5.3.18-150300.59.226.2 SUSE-SU-2025:4188-1
SLE HPC 15 SP3 kernel-default-base 5.3.18-150300.59.226.2.150300.18.134.2 SUSE-SU-2025:4188-1
SLE HPC 15 SP3 kernel-docs 5.3.18-150300.59.226.3 SUSE-SU-2025:4188-1
SLE HPC 15 SP3 kernel-syms 5.3.18-150300.59.226.1 SUSE-SU-2025:4188-1
SUSE Manager Server LTS 4.3 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SUSE Manager Server LTS 4.3 kernel-syms +3 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SUSE Manager Proxy LTS 4.3 kernel-default-base 5.14.21-150400.24.179.1.150400.24.92.1 SUSE-SU-2025:03628-1
SUSE Manager Proxy LTS 4.3 kernel-syms +2 5.14.21-150400.24.179.1 SUSE-SU-2025:03628-1
SUSE Enterprise Storage 7.1 kernel-64kb +4 5.3.18-150300.59.226.2 SUSE-SU-2025:4188-1
SUSE Enterprise Storage 7.1 kernel-default-base 5.3.18-150300.59.226.2.150300.18.134.2 SUSE-SU-2025:4188-1
SUSE Enterprise Storage 7.1 kernel-docs 5.3.18-150300.59.226.3 SUSE-SU-2025:4188-1
SUSE Enterprise Storage 7.1 kernel-syms 5.3.18-150300.59.226.1 SUSE-SU-2025:4188-1

Amazon Linux

ReleasePackageFixed inAdvisory
Amazon Linux 2 kernel-livepatch-4.14.299-223.520 1.0-0.amzn2 ALAS2-2022-1888
Amazon Linux 2 perf +8 4.14.299-223.520.amzn2 ALAS2-2022-1888

Advisories 15

References