Skip to content

Commit fb2cba0

Browse files
Trond MyklebustAnna Schumaker
authored andcommitted
NFS: Check the TLS certificate fields in nfs_match_client()
If the TLS security policy is of type RPC_XPRTSEC_TLS_X509, then the cert_serial and privkey_serial fields need to match as well since they define the client's identity, as presented to the server. Fixes: 90c9550 ("NFS: support the kernel keyring for TLS") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
1 parent 8ab523c commit fb2cba0

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/nfs/client.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,14 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
338338
/* Match the xprt security policy */
339339
if (clp->cl_xprtsec.policy != data->xprtsec.policy)
340340
continue;
341+
if (clp->cl_xprtsec.policy == RPC_XPRTSEC_TLS_X509) {
342+
if (clp->cl_xprtsec.cert_serial !=
343+
data->xprtsec.cert_serial)
344+
continue;
345+
if (clp->cl_xprtsec.privkey_serial !=
346+
data->xprtsec.privkey_serial)
347+
continue;
348+
}
341349

342350
refcount_inc(&clp->cl_count);
343351
return clp;

0 commit comments

Comments
 (0)