ext4: Make sure the MOVE_EXT ioctl can't overwrite append-only files

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Saturday, June 5, 2010 - 8:59 pm

Gitweb:     http://git.kernel.org/linus/1f5a81e41f8b1a782c68d3843e9ec1bfaadf7d72
Commit:     1f5a81e41f8b1a782c68d3843e9ec1bfaadf7d72
Parent:     67a3e12b05e055c0415c556a315a3d3eb637e29e
Author:     Theodore Ts'o <tytso@mit.edu>
AuthorDate: Wed Jun 2 22:04:39 2010 -0400
Committer:  Theodore Ts'o <tytso@mit.edu>
CommitDate: Wed Jun 2 22:04:39 2010 -0400

    ext4: Make sure the MOVE_EXT ioctl can't overwrite append-only files
    
    Dan Roseberg has reported a problem with the MOVE_EXT ioctl.  If the
    donor file is an append-only file, we should not allow the operation
    to proceed, lest we end up overwriting the contents of an append-only
    file.
    
    Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
    Cc: Dan Rosenberg <dan.j.rosenberg@gmail.com>
---
 fs/ext4/move_extent.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
index 3a6c92a..52abfa1 100644
--- a/fs/ext4/move_extent.c
+++ b/fs/ext4/move_extent.c
@@ -960,6 +960,9 @@ mext_check_arguments(struct inode *orig_inode,
 		return -EINVAL;
 	}
 
+	if (IS_IMMUTABLE(donor_inode) || IS_APPEND(donor_inode))
+		return -EPERM;
+
 	/* Ext4 move extent does not support swapfile */
 	if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) {
 		ext4_debug("ext4 move extent: The argument files should "
--
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:
ext4: Make sure the MOVE_EXT ioctl can't overwrite append- ..., Linux Kernel Mailing ..., (Sat Jun 5, 8:59 pm)