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: <41de02bf-3c16-3492-6f9c-7ae4b519778e@linux.alibaba.com>
Date:   Mon, 27 Jul 2020 15:15:04 +0800
From:   Joseph Qi <joseph.qi@...ux.alibaba.com>
To:     Pavel Machek <pavel@....cz>, trivial@...nel.org, mark@...heh.com,
        jlbec@...lplan.org, ocfs2-devel@....oracle.com,
        linux-kernel@...r.kernel.org,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Junxiao Bi <junxiao.bi@...cle.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] ocfs2: fix unbalanced locking



On 2020/7/24 20:44, Pavel Machek wrote:
> 
> Based on what fails, function can return with nfs_sync_rwlock either
> locked or unlocked. That can not be right.
> 
> Always return with lock unlocked on error.
> 
> Signed-off-by: Pavel Machek (CIP) <pavel@...x.de>

Looks good.

Fixes: 4cd9973f9ff6 ("ocfs2: avoid inode removal while nfsd is accessing it")
Reviewed-by: Joseph Qi <joseph.qi@...ux.alibaba.com>

> 
> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
> index 751bc4dc7466..8e3a369086db 100644
> --- a/fs/ocfs2/dlmglue.c
> +++ b/fs/ocfs2/dlmglue.c
> @@ -2871,9 +2871,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex)
>  
>  	status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE,
>  				    0, 0);
> -	if (status < 0)
> +	if (status < 0) {
>  		mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status);
>  
> +		if (ex)
> +			up_write(&osb->nfs_sync_rwlock);
> +		else
> +			up_read(&osb->nfs_sync_rwlock);
> +	}
> +
>  	return status;
>  }
>  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ