From: Josef Bacik Date: Fri, 3 May 2019 15:10:06 +0000 (-0400) Subject: btrfs: don't double unlock on error in btrfs_punch_hole X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=8fca955057b9c58467d1b231e43f19c4cf26ae8c;p=linux.git btrfs: don't double unlock on error in btrfs_punch_hole If we have an error writing out a delalloc range in btrfs_punch_hole_lock_range we'll unlock the inode and then goto out_only_mutex, where we will again unlock the inode. This is bad, don't do this. Fixes: f27451f22996 ("Btrfs: add support for fallocate's zero range operation") CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Filipe Manana Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7e85dca0e6f27..9dbea72a61fee 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2554,10 +2554,8 @@ static int btrfs_punch_hole(struct inode *inode, loff_t offset, loff_t len) ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend, &cached_state); - if (ret) { - inode_unlock(inode); + if (ret) goto out_only_mutex; - } path = btrfs_alloc_path(); if (!path) {