All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ext4 defrag executables
@ 2010-08-29 19:47 Andreas Rid
  0 siblings, 0 replies; only message in thread
From: Andreas Rid @ 2010-08-29 19:47 UTC (permalink / raw)
  To: tytso; +Cc: linux-ext4

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,

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-29 19:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-29 19:47 [patch] ext4 defrag executables Andreas Rid

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.