From: Christoph Hellwig Date: Thu, 12 Feb 2009 18:56:00 +0000 (+0100) Subject: xfs: reject swapext ioctl on swapfiles X-Git-Tag: v2.6.30-rc1~232^2~21^2 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7c8f7af67de19a7ae33a6fc06764771265b0cc56;p=karo-tx-linux.git xfs: reject swapext ioctl on swapfiles 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 Reviewed-by: Felix Blyakher --- diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index ac96ab9f70a2..e6d839bddbf0 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c @@ -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);