In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix use-after-free after failure to create a snapshot
At ioctl.c:create_snapshot(), we allocate a pending snapshot structure and then attach it to the transaction's list of pending snapshots. After that we call btrfs_commit_transaction(), and if that returns an error we jump to 'fail' label, where we kfree() the pending snapshot structure. This can result in a later use-after-free of the pending snapshot:
1) We allocated the pending snapshot and added it to the transaction's list of pending snapshots;
2) We call btrfs_commit_transaction(), and it fails either at the first call to btrfs_run_delayed_refs() or btrfs_start_dirty_block_groups(). In both cases, we don't abort the transaction and we release our transaction handle. We jump to the 'fail' label and free the pending snapshot structure. We return with the pending snapshot still in the transaction's list;
3) Another task commits the transaction. This time there's no error at all, and then during the transaction commit it accesses a pointer to the pending snapshot structure that the snapshot creation task has already freed, resulting in a user-after-free.
This issue could actually be detected by smatch, which produced the following warning:
fs/btrfs/ioctl.c:843 create_snapshot() warn: '&pending_snapshot->list' not removed from list
So fix this by not having the snapshot creation ioctl directly add the pending snapshot to the transaction's list. Instead add the pending snapshot to the transaction handle, and then at btrfs_commit_transaction() we add the snapshot to the list only when we can guarantee that any error returned after that point will result in a transaction abort, in which case the ioctl code can safely free the pending snapshot and no one can access it anymore.
CVSS Details
- CVSS 3.1 Base Score: 7.8
- CVSS 3.1 Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
Covered by Rapid7
| Product | Vendor Advisory | Solution File | Added | Published |
|---|---|---|---|---|
| Amazon Linux Ami 2 | — | Upgrade bpftool-debuginfoUpgrade python-perf-debuginfoUpgrade kernel-livepatch-5.10.226-214.879Upgrade python-perfUpgrade perf-debuginfoUpgrade kernel-headersUpgrade kernel-debuginfo-common-x86_64Upgrade kernelUpgrade kernel-toolsUpgrade kernel-tools-debuginfoUpgrade kernel-debuginfo-common-aarch64Upgrade kernel-develUpgrade kernel-debuginfoUpgrade perfUpgrade kernel-tools-develUpgrade bpftool | Oct 3, 2024 | Jun 20, 2024 |
| Debian | — | Upgrade linux | Jul 30, 2024 | Jun 20, 2024 |
| Suse | — | Upgrade kernel-docsUpgrade kernel-azure-baseUpgrade kernel-defaultUpgrade kernel-rt-extraUpgrade kernel-rt_debug-livepatch-develUpgrade reiserfs-kmp-rtUpgrade dlm-kmp-azureUpgrade kernel-rt_debugUpgrade kernel-azureUpgrade kernel-azure-vdsoUpgrade kselftests-kmp-rtUpgrade kernel-rt_debug-vdsoUpgrade kernel-azure-extraUpgrade kernel-syms-rtUpgrade kernel-rt-livepatch-develUpgrade ocfs2-kmp-azureUpgrade kernel-default-manUpgrade dlm-kmp-rtUpgrade kernel-default-baseUpgrade kernel-obs-buildUpgrade kernel-symsUpgrade kernel-sourceUpgrade kernel-source-rtUpgrade kernel-devel-azureUpgrade kernel-rt-develUpgrade kernel-default-extraUpgrade kernel-default-develUpgrade kernel-devel-rtUpgrade gfs2-kmp-azureUpgrade kselftests-kmp-azureUpgrade kernel-rt-vdsoUpgrade kernel-macrosUpgrade kernel-develUpgrade kernel-rtUpgrade gfs2-kmp-rtUpgrade cluster-md-kmp-rtUpgrade cluster-md-kmp-azureUpgrade ocfs2-kmp-rtUpgrade kernel-syms-azureUpgrade kernel-azure-optionalUpgrade kernel-rt-optionalUpgrade kernel-source-azureUpgrade kernel-rt_debug-develUpgrade kernel-azure-livepatch-develUpgrade reiserfs-kmp-azureUpgrade kernel-rt-livepatchUpgrade kernel-azure-devel | Aug 9, 2024 | Jun 20, 2024 |
| Ubuntu | — | Upgrade linux-image-5.4.0-1135-oracleUpgrade linux-image-4.15.0-231-genericUpgrade linux-image-4.15.0-231-lowlatencyUpgrade linux-image-5.4.0-202-genericUpgrade linux-image-oem-osp1Upgrade linux-image-generic-lpaeUpgrade linux-image-gcp-lts-18.04Upgrade linux-image-4.4.0-261-genericUpgrade linux-image-virtual-hwe-16.04Upgrade linux-image-azure-lts-18.04Upgrade linux-image-virtual-lts-xenialUpgrade linux-image-aws-lts-18.04Upgrade linux-image-genericUpgrade linux-image-gcp-lts-20.04Upgrade linux-image-5.4.0-1083-ibmUpgrade linux-image-lowlatency-hwe-18.04Upgrade linux-image-4.4.0-261-lowlatencyUpgrade linux-image-azure-lts-20.04Upgrade linux-image-lowlatency-hwe-16.04Upgrade linux-image-4.4.0-1139-kvmUpgrade linux-image-gcpUpgrade linux-image-4.4.0-1138-awsUpgrade linux-image-oemUpgrade linux-image-generic-lts-xenialUpgrade linux-image-lowlatencyUpgrade linux-image-snapdragon-hwe-18.04Upgrade linux-image-5.4.0-1096-bluefieldUpgrade linux-image-xilinx-zynqmpUpgrade linux-image-4.15.0-1183-azureUpgrade linux-image-oracle-lts-20.04Upgrade linux-image-gkeUpgrade linux-image-virtualUpgrade linux-image-bluefieldUpgrade linux-image-ibmUpgrade linux-image-raspiUpgrade linux-image-5.4.0-1136-awsUpgrade linux-image-azureUpgrade linux-image-5.4.0-1120-raspiUpgrade linux-image-oracleUpgrade linux-image-5.4.0-202-generic-lpaeUpgrade linux-image-5.4.0-202-lowlatencyUpgrade linux-image-generic-hwe-16.04Upgrade linux-image-aws-hweUpgrade linux-image-raspi2Upgrade linux-image-virtual-hwe-18.04Upgrade linux-image-4.15.0-1137-oracleUpgrade linux-image-4.15.0-1158-kvmUpgrade linux-image-lowlatency-lts-xenialUpgrade linux-image-oracle-lts-18.04Upgrade linux-image-5.4.0-1142-azureUpgrade linux-image-awsUpgrade linux-image-aws-lts-20.04Upgrade linux-image-4.15.0-1168-gcpUpgrade linux-image-generic-hwe-18.04Upgrade linux-image-ibm-lts-20.04Upgrade linux-image-4.15.0-1175-awsUpgrade linux-image-5.4.0-1045-iotUpgrade linux-image-4.4.0-1176-awsUpgrade linux-image-5.4.0-1124-kvmUpgrade linux-image-kvmUpgrade linux-image-raspi-hwe-18.04Upgrade linux-image-5.4.0-1055-xilinx-zynqmpUpgrade linux-image-5.4.0-1140-gcp | Nov 19, 2024 | Jun 20, 2024 |
| Vmware Photon_os | — | Use 'tdnf update' to upgrade all packages to the latest version. | Sep 22, 2025 | Jun 20, 2024 |
Prioritise with Active Threat Intelligence
With curated Threat Intelligence, you can see which vulnerabilities truly put you at risk, prioritize what matters most, and act before attackers do.
Explore Intelligence Hub