diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2016-06-29 13:55:22 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-07-11 15:50:43 -0400 |
commit | a4e187d83d88eeaba6252aac0a2ffe5eaa73a818 (patch) | |
tree | 31ac04d7813866463fccf2ec9ec4dea9c88edc75 | |
parent | 0533b13072f4bf35738290d2cf9e299c7bc6c42a (diff) |
NFS: Don't drop CB requests with invalid principals
Before commit 778be232a207 ("NFS do not find client in NFSv4
pg_authenticate"), the Linux callback server replied with
RPC_AUTH_ERROR / RPC_AUTH_BADCRED, instead of dropping the CB
request. Let's restore that behavior so the server has a chance to
do something useful about it, and provide a warning that helps
admins correct the problem.
Fixes: 778be232a207 ("NFS do not find client in NFSv4 ...")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
-rw-r--r-- | fs/nfs/callback_xdr.c | 6 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index d81f96aacd51..656f68f7fe53 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -925,7 +925,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r | |||
925 | if (hdr_arg.minorversion == 0) { | 925 | if (hdr_arg.minorversion == 0) { |
926 | cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident); | 926 | cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident); |
927 | if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp)) | 927 | if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp)) |
928 | return rpc_drop_reply; | 928 | goto out_invalidcred; |
929 | } | 929 | } |
930 | 930 | ||
931 | cps.minorversion = hdr_arg.minorversion; | 931 | cps.minorversion = hdr_arg.minorversion; |
@@ -953,6 +953,10 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r | |||
953 | nfs_put_client(cps.clp); | 953 | nfs_put_client(cps.clp); |
954 | dprintk("%s: done, status = %u\n", __func__, ntohl(status)); | 954 | dprintk("%s: done, status = %u\n", __func__, ntohl(status)); |
955 | return rpc_success; | 955 | return rpc_success; |
956 | |||
957 | out_invalidcred: | ||
958 | pr_warn_ratelimited("NFS: NFSv4 callback contains invalid cred\n"); | ||
959 | return rpc_autherr_badcred; | ||
956 | } | 960 | } |
957 | 961 | ||
958 | /* | 962 | /* |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index 87290a5a9ac7..c5b0cb4f4056 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -1194,6 +1194,11 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv) | |||
1194 | procp->pc_release(rqstp, NULL, rqstp->rq_resp); | 1194 | procp->pc_release(rqstp, NULL, rqstp->rq_resp); |
1195 | goto dropit; | 1195 | goto dropit; |
1196 | } | 1196 | } |
1197 | if (*statp == rpc_autherr_badcred) { | ||
1198 | if (procp->pc_release) | ||
1199 | procp->pc_release(rqstp, NULL, rqstp->rq_resp); | ||
1200 | goto err_bad_auth; | ||
1201 | } | ||
1197 | if (*statp == rpc_success && | 1202 | if (*statp == rpc_success && |
1198 | (xdr = procp->pc_encode) && | 1203 | (xdr = procp->pc_encode) && |
1199 | !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { | 1204 | !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) { |