In the Linux kernel, the following vulnerability has been resolved: btrfs: use latestdev in btrfsshowdevname The test case btrfs/238 reports the warning below: WARNING: CPU: 3 PID: 481 at fs/btrfs/super.c:2509 btrfsshowdevname+0x104/0x1e8 [btrfs] CPU: 2 PID: 1 Comm: systemd Tainted: G W O 5.14.0-rc1-custom #72 Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015 Call trace: btrfsshowdevname+0x108/0x1b4 [btrfs] showmountinfo+0x234/0x2c4 mshow+0x28/0x34 seqreaditer+0x12c/0x3c4 vfsread+0x29c/0x2c8 ksysread+0x80/0xec _arm64sysread+0x28/0x34 invokesyscall+0x50/0xf8 doel0svc+0x88/0x138 el0svc+0x2c/0x8c el0t64synchandler+0x84/0xe4 el0t64sync+0x198/0x19c Reason: While btrfspreparesprout() moves the fsdevices::devices into fsdevices::seedlist, the btrfsshowdevname() searches for the devices and found none, leading to the warning as in above. Fix: latestdev is updated according to the changes to the device list. That means we could use the latestdev->name to show the device name in /proc/self/mounts, the pointer will be always valid as it's assigned before the device is deleted from the list in remove or replace. The RCU protection is sufficient as the device structure is freed after synchronization.