CVE-2025-37904

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-37904
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-37904.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-37904
Downstream
Published
2025-05-20T15:21:38Z
Modified
2025-10-10T10:16:41.873113Z
Summary
btrfs: fix the inode leak in btrfs_iget()
Details

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

btrfs: fix the inode leak in btrfs_iget()

[BUG] There is a bug report that a syzbot reproducer can lead to the following busy inode at unmount time:

BTRFS info (device loop1): last unmount of filesystem 1680000e-3c1e-4c46-84b6-56bd3909af50 VFS: Busy inodes after unmount of loop1 (btrfs) ------------[ cut here ]------------ kernel BUG at fs/super.c:650! Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI CPU: 0 UID: 0 PID: 48168 Comm: syz-executor Not tainted 6.15.0-rc2-00471-g119009db2674 #2 PREEMPT(full) Hardware name: QEMU Ubuntu 24.04 PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:genericshutdownsuper+0x2e9/0x390 fs/super.c:650 Call Trace: <TASK> killanonsuper+0x3a/0x60 fs/super.c:1237 btrfskillsuper+0x3b/0x50 fs/btrfs/super.c:2099 deactivatelockedsuper+0xbe/0x1a0 fs/super.c:473 deactivatesuper fs/super.c:506 [inline] deactivatesuper+0xe2/0x100 fs/super.c:502 cleanupmnt+0x21f/0x440 fs/namespace.c:1435 taskworkrun+0x14d/0x240 kernel/taskwork.c:227 resumeusermodework include/linux/resumeusermode.h:50 [inline] exittousermodeloop kernel/entry/common.c:114 [inline] exittousermodeprepare include/linux/entry-common.h:329 [inline] _syscallexittousermodework kernel/entry/common.c:207 [inline] syscallexittousermode+0x269/0x290 kernel/entry/common.c:218 dosyscall64+0xd4/0x250 arch/x86/entry/syscall64.c:100 entrySYSCALL64afterhwframe+0x77/0x7f </TASK>

[CAUSE] When btrfsallocpath() failed, btrfsiget() directly returned without releasing the inode already allocated by btrfsiget_locked().

This results the above busy inode and trigger the kernel BUG.

[FIX] Fix it by calling igetfailed() if btrfsalloc_path() failed.

If we hit error inside btrfsreadlockedinode(), it will properly call igetfailed(), so nothing to worry about.

Although the igetfailed() cleanup inside btrfsreadlockedinode() is a break of the normal error handling scheme, let's fix the obvious bug and backport first, then rework the error handling later.

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
7c855e16ab72596d771355050ffe026e6b99f91c
Fixed
30a339bece3a44ab0a821477139e84fb86af9761
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
7c855e16ab72596d771355050ffe026e6b99f91c
Fixed
48c1d1bb525b1c44b8bdc8e7ec5629cb6c2b9fc4

Affected versions

v6.*

v6.12
v6.13
v6.13-rc1
v6.13-rc2
v6.13-rc3
v6.13-rc4
v6.13-rc5
v6.13-rc6
v6.13-rc7
v6.14
v6.14-rc1
v6.14-rc2
v6.14-rc3
v6.14-rc4
v6.14-rc5
v6.14-rc6
v6.14-rc7
v6.14.1
v6.14.2
v6.14.3
v6.14.4
v6.14.5

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.14.6