diff options
author | Jan Kara <jack@suse.cz> | 2012-02-20 11:49:56 -0500 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2012-02-29 15:53:48 -0500 |
commit | a0391a3ae91d301c0e59368531a4de5f0b122bcf (patch) | |
tree | 26425274ff44d43a1a369bf91c7cc5a78756b30d /fs | |
parent | b2527bfa535956d99663718b9d9aac0b8fe3f017 (diff) |
udf: Fix deadlock in udf_release_file()
udf_release_file() can be called from munmap() path with mmap_sem held. Thus
we cannot take i_mutex there because that ranks above mmap_sem. Luckily,
i_mutex is not needed in udf_release_file() anymore since protection by
i_data_sem is enough to protect from races with write and truncate.
CC: stable@vger.kernel.org (2.6.38 & later)
Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Reviewed-by: Namjae Jeon <linkinjeon@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/udf/file.c | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/fs/udf/file.c b/fs/udf/file.c index dca0c3881e82..d567b8448dfc 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -201,12 +201,10 @@ out: | |||
201 | static int udf_release_file(struct inode *inode, struct file *filp) | 201 | static int udf_release_file(struct inode *inode, struct file *filp) |
202 | { | 202 | { |
203 | if (filp->f_mode & FMODE_WRITE) { | 203 | if (filp->f_mode & FMODE_WRITE) { |
204 | mutex_lock(&inode->i_mutex); | ||
205 | down_write(&UDF_I(inode)->i_data_sem); | 204 | down_write(&UDF_I(inode)->i_data_sem); |
206 | udf_discard_prealloc(inode); | 205 | udf_discard_prealloc(inode); |
207 | udf_truncate_tail_extent(inode); | 206 | udf_truncate_tail_extent(inode); |
208 | up_write(&UDF_I(inode)->i_data_sem); | 207 | up_write(&UDF_I(inode)->i_data_sem); |
209 | mutex_unlock(&inode->i_mutex); | ||
210 | } | 208 | } |
211 | return 0; | 209 | return 0; |
212 | } | 210 | } |