Skip to content

Commit 0e38983

Browse files
committed
Merge tag 'for-6.7-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fix from David Sterba: "One more fix that verifies that the snapshot source is a root, same check is also done in user space but should be done by the ioctl as well" * tag 'for-6.7-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: do not allow non subvolume root targets for snapshot
2 parents accc98a + a8892fd commit 0e38983

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/btrfs/ioctl.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,15 @@ static noinline int __btrfs_ioctl_snap_create(struct file *file,
12901290
* are limited to own subvolumes only
12911291
*/
12921292
ret = -EPERM;
1293+
} else if (btrfs_ino(BTRFS_I(src_inode)) != BTRFS_FIRST_FREE_OBJECTID) {
1294+
/*
1295+
* Snapshots must be made with the src_inode referring
1296+
* to the subvolume inode, otherwise the permission
1297+
* checking above is useless because we may have
1298+
* permission on a lower directory but not the subvol
1299+
* itself.
1300+
*/
1301+
ret = -EINVAL;
12931302
} else {
12941303
ret = btrfs_mksnapshot(&file->f_path, idmap,
12951304
name, namelen,

0 commit comments

Comments
 (0)