[PATCH] vfs: Fix possible chmod/truncate race condition.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Dmitri Monakhov
Date: Wednesday, October 15, 2008 - 12:35 pm

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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] vfs: Fix possible chmod/truncate race condition., Dmitri Monakhov, (Wed Oct 15, 12:35 pm)
Re: [PATCH] vfs: Fix possible chmod/truncate race condition., Dmitri Monakhov, (Mon Oct 27, 12:57 am)