diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2010-03-05 13:42:01 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-03-15 09:05:56 -0700 |
commit | 686056f1efec9d121a342dce70bffda664365865 (patch) | |
tree | cedacd2731d562d27faabc6b067133dc0f4059fe /fs/file_table.c | |
parent | 8635bb47c2a2f4d26ee42376b18e73c853570c41 (diff) | |
download | kernel-crypto-686056f1efec9d121a342dce70bffda664365865.tar.gz kernel-crypto-686056f1efec9d121a342dce70bffda664365865.tar.xz kernel-crypto-686056f1efec9d121a342dce70bffda664365865.zip |
vfs: take f_lock on modifying f_mode after open time
commit 42e49608683ab25fbbbf9c40edb944601e543882 upstream.
We'll introduce FMODE_RANDOM which will be runtime modified. So protect
all runtime modification to f_mode with f_lock to avoid races.
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/file_table.c')
-rw-r--r-- | fs/file_table.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/file_table.c b/fs/file_table.c index b98404b5438..32d12b78bac 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); |