lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20141016124047.GA42623@bfoster.bfoster>
Date:	Thu, 16 Oct 2014 08:40:48 -0400
From:	Brian Foster <bfoster@...hat.com>
To:	Alexey Khoroshilov <khoroshilov@...ras.ru>
Cc:	Dave Chinner <david@...morbit.com>, xfs@....sgi.com,
	linux-kernel@...r.kernel.org, spruce-project@...uxtesting.org
Subject: Re: [PATCH] xfs: fix deadlock on failure path in
 xfs_setattr_nonsize()

On Wed, Oct 15, 2014 at 11:22:48PM +0200, Alexey Khoroshilov wrote:
> If xfs_trans_reserve() fails, xfs_setattr_nonsize() does not deallocate
> the transaction and does not release "freeze" lock. That leads to the
> following warning from lockdep:
>   [ BUG: lock held when returning to user space! ]
>   ------------------------------------------------
>   fs-driver-tests/7127 is leaving the kernel with locks still held!
>   1 lock held by fs-driver-tests/7127:
>    #0:  (sb_internal){.+.+.+}, at: [<ffffffffa0389a44>] xfs_trans_alloc+0x24/0x40 [xfs]
> 
> The patch adds xfs_trans_cancel() on the failure path.
> 
> Found by Linux File System Verification project (linuxtesting.org).
> 
> Signed-off-by: Alexey Khoroshilov <khoroshilov@...ras.ru>
> ---

Looks good, thanks for the patch.

Reviewed-by: Brian Foster <bfoster@...hat.com>

>  fs/xfs/xfs_iops.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index 72129493e9d3..e2e785eec831 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -599,8 +599,10 @@ xfs_setattr_nonsize(
>  
>  	tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
>  	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_ichange, 0, 0);
> -	if (error)
> +	if (error) {
> +		xfs_trans_cancel(tp, 0);
>  		goto out_dqrele;
> +	}
>  
>  	xfs_ilock(ip, XFS_ILOCK_EXCL);
>  
> -- 
> 1.9.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ