Commit f6940fe9092e796119af691c7f722c252f4fc524
Committed by
Al Viro
1 parent
978d6d8c45
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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. Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Reviewed-by: Namjae Jeon <linkinjeon@gmail.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 0 additions and 2 deletions Side-by-side Diff
fs/udf/file.c
... | ... | @@ -201,12 +201,10 @@ |
201 | 201 | static int udf_release_file(struct inode *inode, struct file *filp) |
202 | 202 | { |
203 | 203 | if (filp->f_mode & FMODE_WRITE) { |
204 | - mutex_lock(&inode->i_mutex); | |
205 | 204 | down_write(&UDF_I(inode)->i_data_sem); |
206 | 205 | udf_discard_prealloc(inode); |
207 | 206 | udf_truncate_tail_extent(inode); |
208 | 207 | up_write(&UDF_I(inode)->i_data_sem); |
209 | - mutex_unlock(&inode->i_mutex); | |
210 | 208 | } |
211 | 209 | return 0; |
212 | 210 | } |