VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Wu Fengguang <fengguang.wu@intel.com> 2010-03-05 13:42:01 -0800 committer: Linus Torvalds <torvalds@linux-foundation.org> 2010-03-06 11:26:25 -0800 commit: 42e49608683ab25fbbbf9c40edb944601e543882 parent: 85f1fb72fa76eabc4481dc79f42d2b011df54762
Commit Summary:
vfs: take f_lock on modifying f_mode after open time
Diffstat:
1 file changed, 2 insertions, 0 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index b98404b54383..32d12b78bac8 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -393,7 +393,9 @@ retry:
 			continue;
 		if (!(f->f_mode & FMODE_WRITE))
 			continue;
+		spin_lock(&f->f_lock);
 		f->f_mode &= ~FMODE_WRITE;
+		spin_unlock(&f->f_lock);
 		if (file_check_writeable(f) != 0)
 			continue;
 		file_release_write(f);