All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Rid <andreas@rid-net.de>
To: tytso@mit.edu
Cc: linux-ext4@vger.kernel.org
Subject: [patch] ext4 defrag executables
Date: Sun, 29 Aug 2010 21:47:47 +0200	[thread overview]
Message-ID: <4C7AB963.6030401@rid-net.de> (raw)

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,

                 reply	other threads:[~2010-08-29 19:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C7AB963.6030401@rid-net.de \
    --to=andreas@rid-net.de \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.