]> git.baikalelectronics.ru Git - kernel.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)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 3 Feb 2020 21:35:07 +0000 (16:35 -0500)
When comparing two 'struct cred' for equality w.r.t. behaviour under
filesystem access, we need to use cred_fscmp().

Fixes: c04f0e0ce679 ("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>
fs/nfs/pnfs.c

index 3ac6b4dea72d3561ebc6bedd92b6e2e100730f92..542ea8dfd1bc75165cc78cccd1b14d4ef650c8f1 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;