btrfs: fix use-after-free on inode when scanning root during em shrinking
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.13.66.14In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix use-after-free on inode when scanning root during em shrinking
At btrfs_scan_root() we are accessing the inode's root (and fs_info) in a call to btrfs_fs_closing() after we have scheduled the inode for a delayed iput, and that can result in a use-after-free on the inode in case the cleaner kthread does the iput before we dereference the inode in the call to btrfs_fs_closing().
Fix this by using the fs_info stored already in a local variable instead of doing inode->root->fs_info.
From the CVE record · Linux
The Linux kernel’s btrfs root scan can access an inode after it has been freed during extent-map shrinking. This can occur if the cleaner thread releases the inode before the scan checks whether the filesystem is closing. The input does not specify how an attacker could trigger the race or what access they would need.
Engineers running Linux kernels with btrfs should check whether their kernel includes the fix; affected versions were not specified.