Skip to content

Commit

Permalink
xfs: reject swapext ioctl on swapfiles
Browse files Browse the repository at this point in the history
Swapfiles are magic - I/O is directly initialized by the VM without
involving the filesystem.  Swapping out extents underneath the VM thus
can cause severe problems.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Felix Blyakher <felixb@sgi.com>
  • Loading branch information
Christoph Hellwig authored and Christoph Hellwig committed Feb 12, 2009
1 parent 2643075 commit 7c8f7af
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/xfs/xfs_dfrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ xfs_swapext(
goto out_put_target_file;
}

if (IS_SWAPFILE(file->f_path.dentry->d_inode) ||
IS_SWAPFILE(target_file->f_path.dentry->d_inode)) {
error = XFS_ERROR(EINVAL);
goto out_put_target_file;
}

ip = XFS_I(file->f_path.dentry->d_inode);
tip = XFS_I(target_file->f_path.dentry->d_inode);

Expand Down

0 comments on commit 7c8f7af

Please sign in to comment.