xfs: reject swapext ioctl on swapfiles

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, April 3, 2009 - 11:06 am

Gitweb:     http://git.kernel.org/linus/7c8f7af67de19a7ae33a6fc06764771265b0cc56
Commit:     7c8f7af67de19a7ae33a6fc06764771265b0cc56
Parent:     264307520b120593ba63c4a23c58dd5e2ec5e822
Author:     Christoph Hellwig <hch@lst.de>
AuthorDate: Thu Feb 12 19:56:00 2009 +0100
Committer:  Christoph Hellwig <hch@brick.lst.de>
CommitDate: Thu Feb 12 19:56:00 2009 +0100

    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 <hch@lst.de>
    Reviewed-by: Felix Blyakher <felixb@sgi.com>
---
 fs/xfs/xfs_dfrag.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c
index ac96ab9..e6d839b 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);
 
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
xfs: reject swapext ioctl on swapfiles, Linux Kernel Mailing ..., (Fri Apr 3, 11:06 am)