[patch] ext4 defrag executables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,

since ioctl EXT4_IOC_MOVE_EXT checks the original file descriptor for write access it's no longer possible to defrag executable files which are currently in use. This is because you can only open() those files readonly.
This patch solves it without adding a security hole. 
What do you think about it?

 Andreas


diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index 352cb35..ae45380 100644
--- a/fs/ext4/ioctl.c
+++ b/fs/ext4/ioctl.c
@@ -242,8 +242,8 @@ setversion_out:
 		struct file *donor_filp;
 		int err;
 
-		if (!(filp->f_mode & FMODE_READ) ||
-		    !(filp->f_mode & FMODE_WRITE))
+		if (generic_permission(filp->f_dentry->d_inode,
+			MAY_READ | MAY_WRITE, NULL))
 			return -EBADF;
 
 		if (copy_from_user(&me,
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux