diff options
| author | Theodore Ts'o <tytso@mit.edu> | 2010-06-02 22:04:39 -0400 | 
|---|---|---|
| committer | Theodore Ts'o <tytso@mit.edu> | 2010-06-02 22:04:39 -0400 | 
| commit | 1f5a81e41f8b1a782c68d3843e9ec1bfaadf7d72 (patch) | |
| tree | 471ac26edd4fbdfda5a3b091b9d583d579c882cb /fs/ext4/move_extent.c | |
| parent | 67a3e12b05e055c0415c556a315a3d3eb637e29e (diff) | |
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>
Diffstat (limited to 'fs/ext4/move_extent.c')
| -rw-r--r-- | 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 3a6c92ac131c..52abfa12762a 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
| @@ -960,6 +960,9 @@ mext_check_arguments(struct inode *orig_inode, | |||
| 960 | return -EINVAL; | 960 | return -EINVAL; | 
| 961 | } | 961 | } | 
| 962 | 962 | ||
| 963 | if (IS_IMMUTABLE(donor_inode) || IS_APPEND(donor_inode)) | ||
| 964 | return -EPERM; | ||
| 965 | |||
| 963 | /* Ext4 move extent does not support swapfile */ | 966 | /* Ext4 move extent does not support swapfile */ | 
| 964 | if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) { | 967 | if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) { | 
| 965 | ext4_debug("ext4 move extent: The argument files should " | 968 | ext4_debug("ext4 move extent: The argument files should " | 
