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 kernel-debuginfo-common-aarch64Upgrade kernel-develUpgrade kernel-debuginfoUpgrade kernel-tools-develUpgrade perfUpgrade kernel-tools-debuginfoUpgrade bpftoolUpgrade kernel-headersUpgrade bpftool-debuginfoUpgrade python-perfUpgrade perf-debuginfoUpgrade python-perf-debuginfoUpgrade kernel-livepatch-5.10.226-214.879Upgrade kernel-debuginfo-common-x86_64Upgrade kernel-toolsUpgrade kernel | Oct 3, 2024 | Jun 20, 2024 |
| Debian | — | Upgrade linux | Jul 30, 2024 | Jun 20, 2024 |
| Suse | — | Upgrade kernel-default-develUpgrade kernel-default-extraUpgrade kernel-syms-azureUpgrade kernel-devel-rtUpgrade kernel-rt-vdsoUpgrade gfs2-kmp-azureUpgrade kselftests-kmp-azureUpgrade kernel-develUpgrade kernel-macrosUpgrade kernel-rt-livepatchUpgrade kernel-sourceUpgrade kernel-azure-develUpgrade kernel-rt-optionalUpgrade kernel-source-azureUpgrade kernel-azure-livepatch-develUpgrade kernel-rt_debug-develUpgrade cluster-md-kmp-azureUpgrade gfs2-kmp-rtUpgrade kernel-symsUpgrade kernel-devel-azureUpgrade kernel-azure-optionalUpgrade kernel-rt-develUpgrade ocfs2-kmp-rtUpgrade kernel-source-rtUpgrade kernel-rtUpgrade cluster-md-kmp-rtUpgrade reiserfs-kmp-azureUpgrade kernel-azure-extraUpgrade kernel-default-manUpgrade kernel-docsUpgrade kernel-azure-vdsoUpgrade reiserfs-kmp-rtUpgrade kernel-obs-buildUpgrade kernel-default-baseUpgrade kernel-azureUpgrade ocfs2-kmp-azureUpgrade dlm-kmp-rtUpgrade kernel-rt_debugUpgrade kernel-rt-extraUpgrade kernel-azure-baseUpgrade kernel-rt_debug-livepatch-develUpgrade kernel-rt_debug-vdsoUpgrade kselftests-kmp-rtUpgrade kernel-defaultUpgrade dlm-kmp-azureUpgrade kernel-syms-rtUpgrade kernel-rt-livepatch-devel | Aug 9, 2024 | Jun 20, 2024 |
| Ubuntu | — | Upgrade linux-image-lowlatencyUpgrade linux-image-4.4.0-261-lowlatencyUpgrade linux-image-virtual-hwe-16.04Upgrade linux-image-azure-lts-18.04Upgrade linux-image-4.4.0-261-genericUpgrade linux-image-5.4.0-1135-oracleUpgrade linux-image-snapdragon-hwe-18.04Upgrade linux-image-gcp-lts-18.04Upgrade linux-image-xilinx-zynqmpUpgrade linux-image-oemUpgrade linux-image-genericUpgrade linux-image-generic-lpaeUpgrade linux-image-aws-lts-18.04Upgrade linux-image-4.15.0-231-genericUpgrade linux-image-4.4.0-1139-kvmUpgrade linux-image-lowlatency-hwe-16.04Upgrade linux-image-gcpUpgrade linux-image-generic-lts-xenialUpgrade linux-image-5.4.0-1083-ibmUpgrade linux-image-5.4.0-1096-bluefieldUpgrade linux-image-gcp-lts-20.04Upgrade linux-image-gkeUpgrade linux-image-4.15.0-231-lowlatencyUpgrade linux-image-azure-lts-20.04Upgrade linux-image-5.4.0-202-genericUpgrade linux-image-virtual-lts-xenialUpgrade linux-image-oem-osp1Upgrade linux-image-virtualUpgrade linux-image-4.4.0-1138-awsUpgrade linux-image-4.15.0-1183-azureUpgrade linux-image-oracle-lts-20.04Upgrade linux-image-lowlatency-hwe-18.04Upgrade linux-image-raspi-hwe-18.04Upgrade linux-image-oracle-lts-18.04Upgrade linux-image-lowlatency-lts-xenialUpgrade linux-image-aws-lts-20.04Upgrade linux-image-kvmUpgrade linux-image-5.4.0-1136-awsUpgrade linux-image-oracleUpgrade linux-image-azureUpgrade linux-image-5.4.0-1120-raspiUpgrade linux-image-5.4.0-1124-kvmUpgrade linux-image-virtual-hwe-18.04Upgrade linux-image-aws-hweUpgrade linux-image-4.15.0-1175-awsUpgrade linux-image-generic-hwe-16.04Upgrade linux-image-4.4.0-1176-awsUpgrade linux-image-generic-hwe-18.04Upgrade linux-image-raspiUpgrade linux-image-bluefieldUpgrade linux-image-5.4.0-1055-xilinx-zynqmpUpgrade linux-image-5.4.0-202-lowlatencyUpgrade linux-image-5.4.0-1140-gcpUpgrade linux-image-ibm-lts-20.04Upgrade linux-image-raspi2Upgrade linux-image-5.4.0-1045-iotUpgrade linux-image-4.15.0-1158-kvmUpgrade linux-image-4.15.0-1137-oracleUpgrade linux-image-awsUpgrade linux-image-5.4.0-1142-azureUpgrade linux-image-ibmUpgrade linux-image-4.15.0-1168-gcpUpgrade linux-image-5.4.0-202-generic-lpae | 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