From: Theodore Ts'o Date: Thu, 3 Jun 2010 02:04:39 +0000 (-0400) Subject: ext4: Make sure the MOVE_EXT ioctl can't overwrite append-only files X-Git-Tag: v2.6.34.1~30 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=94f98453eab3c95eaa40132b2e78cc4edc1bf48f;p=users%2Fdwmw2%2Flinux.git ext4: Make sure the MOVE_EXT ioctl can't overwrite append-only files commit 1f5a81e41f8b1a782c68d3843e9ec1bfaadf7d72 upstream. 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" Cc: Dan Rosenberg Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index d1fc662cc3110..d3d6a649e3a77 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c @@ -959,6 +959,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 "