mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	NFS: Don't drop CB requests with invalid principals
Before commit778be232a2("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:778be232a2("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>
This commit is contained in:
		
							parent
							
								
									0533b13072
								
							
						
					
					
						commit
						a4e187d83d
					
				
					 2 changed files with 10 additions and 1 deletions
				
			
		| 
						 | 
					@ -925,7 +925,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 | 
				
			||||||
	if (hdr_arg.minorversion == 0) {
 | 
						if (hdr_arg.minorversion == 0) {
 | 
				
			||||||
		cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
 | 
							cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
 | 
				
			||||||
		if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
 | 
							if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
 | 
				
			||||||
			return rpc_drop_reply;
 | 
								goto out_invalidcred;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cps.minorversion = hdr_arg.minorversion;
 | 
						cps.minorversion = hdr_arg.minorversion;
 | 
				
			||||||
| 
						 | 
					@ -953,6 +953,10 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 | 
				
			||||||
	nfs_put_client(cps.clp);
 | 
						nfs_put_client(cps.clp);
 | 
				
			||||||
	dprintk("%s: done, status = %u\n", __func__, ntohl(status));
 | 
						dprintk("%s: done, status = %u\n", __func__, ntohl(status));
 | 
				
			||||||
	return rpc_success;
 | 
						return rpc_success;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					out_invalidcred:
 | 
				
			||||||
 | 
						pr_warn_ratelimited("NFS: NFSv4 callback contains invalid cred\n");
 | 
				
			||||||
 | 
						return rpc_autherr_badcred;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1194,6 +1194,11 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 | 
				
			||||||
				procp->pc_release(rqstp, NULL, rqstp->rq_resp);
 | 
									procp->pc_release(rqstp, NULL, rqstp->rq_resp);
 | 
				
			||||||
			goto dropit;
 | 
								goto dropit;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							if (*statp == rpc_autherr_badcred) {
 | 
				
			||||||
 | 
								if (procp->pc_release)
 | 
				
			||||||
 | 
									procp->pc_release(rqstp, NULL, rqstp->rq_resp);
 | 
				
			||||||
 | 
								goto err_bad_auth;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if (*statp == rpc_success &&
 | 
							if (*statp == rpc_success &&
 | 
				
			||||||
		    (xdr = procp->pc_encode) &&
 | 
							    (xdr = procp->pc_encode) &&
 | 
				
			||||||
		    !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
 | 
							    !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue