Skip to content

Commit

Permalink
nfsd4: fix null dereference creating nfsv4 callback client
Browse files Browse the repository at this point in the history
On setting up the callback to the client, we attempt to use the same
authentication flavor the client did.  We find an rpc cred to use by
calling rpcauth_lookup_credcache(), which assumes that the given
authentication flavor has a credentials cache.  However, this is not
required to be true--in particular, auth_null does not use one.
Instead, we should call the auth's lookup_cred() method.

Without this, a client attempting to mount using nfsv4 and auth_null
triggers a null dereference.

Cc: stable@kernel.org
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
J. Bruce Fields committed Sep 16, 2009
1 parent 4be36ca commit 886e3b7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/nfsd/nfs4callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,15 @@ static struct rpc_cred *lookup_cb_cred(struct nfs4_cb_conn *cb)
struct auth_cred acred = {
.machine_cred = 1
};
struct rpc_auth *auth = cb->cb_client->cl_auth;

/*
* Note in the gss case this doesn't actually have to wait for a
* gss upcall (or any calls to the client); this just creates a
* non-uptodate cred which the rpc state machine will fill in with
* a refresh_upcall later.
*/
return rpcauth_lookup_credcache(cb->cb_client->cl_auth, &acred,
RPCAUTH_LOOKUP_NEW);
return auth->au_ops->lookup_cred(auth, &acred, RPCAUTH_LOOKUP_NEW);
}

void do_probe_callback(struct nfs4_client *clp)
Expand Down

0 comments on commit 886e3b7

Please sign in to comment.