linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: add missing mutex lock arround notify_change
@ 2011-12-16 11:25 Djalal Harouni
  2011-12-16 20:55 ` Andrew Morton
  0 siblings, 1 reply; 12+ messages in thread
From: Djalal Harouni @ 2011-12-16 11:25 UTC (permalink / raw)
  To: Andrew Morton, Hugh Dickins, Minchan Kim, KAMEZAWA Hiroyuki,
	Wu Fengguang
  Cc: linux-mm, linux-kernel


Calls to notify_change() must hold i_mutex.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
---
 mm/filemap.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/mm/filemap.c b/mm/filemap.c
index c106d3b..0670ec1 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1994,10 +1994,16 @@ EXPORT_SYMBOL(should_remove_suid);
 
 static int __remove_suid(struct dentry *dentry, int kill)
 {
+	int ret;
 	struct iattr newattrs;
 
 	newattrs.ia_valid = ATTR_FORCE | kill;
-	return notify_change(dentry, &newattrs);
+
+	mutex_lock(&dentry->d_inode->i_mutex);
+	ret = notify_change(dentry, &newattrs);
+	mutex_unlock(&dentry->d_inode->i_mutex);
+
+	return ret;
 }
 
 int file_remove_suid(struct file *file)
-- 
1.7.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-12-20 22:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-16 11:25 [PATCH] mm: add missing mutex lock arround notify_change Djalal Harouni
2011-12-16 20:55 ` Andrew Morton
2011-12-16 21:54   ` Djalal Harouni
2011-12-17 21:41   ` Al Viro
2011-12-17 22:10     ` Al Viro
2011-12-20 22:09       ` Ted Ts'o
2011-12-20 22:45         ` Ted Ts'o
2011-12-19  1:43     ` Dave Chinner
2011-12-19  2:03       ` Al Viro
2011-12-19  2:06         ` Al Viro
2011-12-19  5:07           ` Dave Chinner
2011-12-19  4:22         ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).