Skip to content

Commit

Permalink
nfsd: fix unlikely NULL deref in mach_creds_match
Browse files Browse the repository at this point in the history
We really shouldn't allow a client to be created with cl_mach_cred set
unless it also has a principal name.

This also allows us to fail such cases immediately on EXCHANGE_ID as
opposed to waiting and incorrectly returning WRONG_CRED on the following
CREATE_SESSION.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
J. Bruce Fields committed Nov 24, 2015
1 parent 50c7b94 commit 920dd9b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,15 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
status = nfserr_inval;
goto out_nolock;
}
/*
* Sometimes userspace doesn't give us a principal.
* Which is a bug, really. Anyway, we can't enforce
* MACH_CRED in that case, better to give up now:
*/
if (!new->cl_cred.cr_principal) {
status = nfserr_serverfault;
goto out_nolock;
}
new->cl_mach_cred = true;
case SP4_NONE:
break;
Expand Down

0 comments on commit 920dd9b

Please sign in to comment.