]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSv4: pnfs_roc() must use cred_fscmp() to compare creds
authorTrond Myklebust <trondmy@gmail.com>
Sun, 26 Jan 2020 22:31:13 +0000 (17:31 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Feb 2020 21:34:10 +0000 (16:34 -0500)
commit 387122478775be5d9816c34aa29de53d0b926835 upstream.

When comparing two 'struct cred' for equality w.r.t. behaviour under
filesystem access, we need to use cred_fscmp().

Fixes: a52458b48af1 ("NFS/NFSD/SUNRPC: replace generic creds with 'struct cred'.")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/pnfs.c

index bb80034a7661956aafeb248f5e233554aa838b8b..443639cbb0cfc0a4b85785d50f49d05b0d0baef1 100644 (file)
@@ -1425,7 +1425,7 @@ retry:
        /* lo ref dropped in pnfs_roc_release() */
        layoutreturn = pnfs_prepare_layoutreturn(lo, &stateid, &iomode);
        /* If the creds don't match, we can't compound the layoutreturn */
-       if (!layoutreturn || cred != lo->plh_lc_cred)
+       if (!layoutreturn || cred_fscmp(cred, lo->plh_lc_cred) != 0)
                goto out_noroc;
 
        roc = layoutreturn;