Commit 18b9a895 authored by Scott Mayhew's avatar Scott Mayhew Committed by J. Bruce Fields

nfsd: Fix cld_net->cn_tfm initialization

Don't assign an error pointer to cld_net->cn_tfm, otherwise an oops will
occur in nfsd4_remove_cld_pipe().

Also, move the initialization of cld_net->cn_tfm so that it occurs after
the check to see if nfsdcld is running.  This is necessary because
nfsd4_client_tracking_init() looks for -ETIMEDOUT to determine whether
to use the "old" nfsdcld tracking ops.

Fixes: 6ee95d1c ("nfsd: add support for upcall version 2")
Reported-by: default avatarJamie Heilman <jamie@audible.transient.net>
Signed-off-by: default avatarScott Mayhew <smayhew@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent fb7dd0a1
...@@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net) ...@@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net)
struct nfsd_net *nn = net_generic(net, nfsd_net_id); struct nfsd_net *nn = net_generic(net, nfsd_net_id);
bool running; bool running;
int retries = 10; int retries = 10;
struct crypto_shash *tfm;
status = nfs4_cld_state_init(net); status = nfs4_cld_state_init(net);
if (status) if (status)
...@@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net) ...@@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net)
status = __nfsd4_init_cld_pipe(net); status = __nfsd4_init_cld_pipe(net);
if (status) if (status)
goto err_shutdown; goto err_shutdown;
nn->cld_net->cn_tfm = crypto_alloc_shash("sha256", 0, 0);
if (IS_ERR(nn->cld_net->cn_tfm)) {
status = PTR_ERR(nn->cld_net->cn_tfm);
goto err_remove;
}
/* /*
* rpc pipe upcalls take 30 seconds to time out, so we don't want to * rpc pipe upcalls take 30 seconds to time out, so we don't want to
...@@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net) ...@@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net)
status = -ETIMEDOUT; status = -ETIMEDOUT;
goto err_remove; goto err_remove;
} }
tfm = crypto_alloc_shash("sha256", 0, 0);
if (IS_ERR(tfm)) {
status = PTR_ERR(tfm);
goto err_remove;
}
nn->cld_net->cn_tfm = tfm;
status = nfsd4_cld_get_version(nn); status = nfsd4_cld_get_version(nn);
if (status == -EOPNOTSUPP) if (status == -EOPNOTSUPP)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment