summaryrefslogtreecommitdiff
path: root/tools/lib/python
diff options
context:
space:
mode:
authorguolingxing <guolingxing@tju.edu.cn>2026-10-18 15:38:10 +0000
committerDavid Sterba <dsterba@suse.com>2026-10-30 23:15:19 +0100
commit1960146913b31b288ed2cd607d103ee3b41681d4 (patch)
tree9a5eb4cb7daab3fa585a733aa3696d17c5d79ff5 /tools/lib/python
parent8b797abaaf0f9447f98c05a148b5b35c39b88f8a (diff)
btrfs: prevent deleting the wrong subvolume by ID
When deleting a subvolume by ID, btrfs_ioctl_snap_destroy() first resolves the requested ID to a name, then looks up that name again under the parent directory lock. A concurrent rename can change which subvolume is associated with the name between these operations. Since the deletion path does not verify the ID of the resolved subvolume, it can delete a different subvolume while leaving the requested one intact. This was reproduced by repeatedly exchanging the names of two subvolumes using renameat2(RENAME_EXCHANGE) while deleting one of them by ID. The wrong subvolume was deleted in 9 out of 14 independent tests. Fix this by checking that the resolved subvolume ID matches the requested ID while holding the parent directory lock. Return -EAGAIN on a mismatch so that userspace can retry the operation instead of being told that the requested subvolume does not exist. Fixes: 949964c92843 ("btrfs: add new BTRFS_IOC_SNAP_DESTROY_V2 ioctl") CC: stable@vger.kernel.org Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: guolingxing <guolingxing@tju.edu.cn> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions