Re: [PATCH] udf: Fix deadlock in udf_release_file()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/2/21 Jan Kara <jack@xxxxxxx>:
> 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@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Jan Kara <jack@xxxxxxx>
HI. Jan.
Looks reasonable to me. And I think that this patch should be added in
stable kernel.
So I add cc: stable@xxxxxxxxxxxxxxx.

Reviewed-by: Namjae Jeon <linkinjeon@xxxxxxxxx>

> ---
>  fs/udf/file.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
>  If noone objects, I will add this patch to my tree and push it to Linus.
>
> diff --git a/fs/udf/file.c b/fs/udf/file.c
> index dca0c38..d567b84 100644
> --- a/fs/udf/file.c
> +++ b/fs/udf/file.c
> @@ -201,12 +201,10 @@ out:
>  static int udf_release_file(struct inode *inode, struct file *filp)
>  {
>        if (filp->f_mode & FMODE_WRITE) {
> -               mutex_lock(&inode->i_mutex);
>                down_write(&UDF_I(inode)->i_data_sem);
>                udf_discard_prealloc(inode);
>                udf_truncate_tail_extent(inode);
>                up_write(&UDF_I(inode)->i_data_sem);
> -               mutex_unlock(&inode->i_mutex);
>        }
>        return 0;
>  }
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux