public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitri Monakhov <dmonakhov@openvz.org>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] vfs: Fix possible chmod/truncate race condition.
Date: Wed, 15 Oct 2008 23:35:27 +0400	[thread overview]
Message-ID: <m33aixy7ls.fsf@dmon-lap.sw.ru> (raw)


Signed-off-by: Dmitri Monakhov <dmonakhov@openvz.org>
---
 fs/open.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fs/open.c b/fs/open.c
index 07da935..3423b94 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -214,10 +214,9 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs,
 		newattrs.ia_valid |= ATTR_FILE;
 	}
 
+	mutex_lock(&dentry->d_inode->i_mutex);
 	/* Remove suid/sgid on truncate too */
 	newattrs.ia_valid |= should_remove_suid(dentry);
-
-	mutex_lock(&dentry->d_inode->i_mutex);
 	err = notify_change(dentry, &newattrs);
 	mutex_unlock(&dentry->d_inode->i_mutex);
 	return err;
-- 
1.5.4.3


             reply	other threads:[~2008-10-15 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-15 19:35 Dmitri Monakhov [this message]
2008-10-27  3:37 ` [PATCH] vfs: Fix possible chmod/truncate race condition Andrew Morton
2008-10-27  7:57   ` Dmitri Monakhov

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=m33aixy7ls.fsf@dmon-lap.sw.ru \
    --to=dmonakhov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox