Re: [PATCH] nfsd: Detect unhashed stids in nfsd4_verify_open_stid()

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

 




> On Jan 12, 2018, at 5:42 PM, Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> wrote:
> 
> The state of the stid is guaranteed by 2 locks:
> - The nfs4_client 'cl_lock' spinlock
> - The nfs4_ol_stateid 'st_mutex' mutex
> 
> so it is quite possible for the stid to be unhashed after lookup,
> but before calling nfsd4_lock_ol_stateid(). So we do need to check
> for a zero value for 'sc_type' in nfsd4_verify_open_stid().
> 
> Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>

Three successful passes of the git regression suite on NFSv4.1
Three successful passes of xfstests on NFSv4.1

Tested-by: Chuck Lever <chuck.lever@xxxxxxxxxx>


> ---
> fs/nfsd/nfs4state.c | 1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 8d53d29161f5..b5bda115f6a9 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -3591,6 +3591,7 @@ nfsd4_verify_open_stid(struct nfs4_stid *s)
> 	switch (s->sc_type) {
> 	default:
> 		break;
> +	case 0:
> 	case NFS4_CLOSED_STID:
> 	case NFS4_CLOSED_DELEG_STID:
> 		ret = nfserr_bad_stateid;
> -- 
> 2.14.3
> 

--
Chuck Lever



--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux