Skip to content

Commit 18b9a89

Browse files
scottmayhewJ. Bruce Fields
authored andcommitted
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: 6ee95d1 ("nfsd: add support for upcall version 2") Reported-by: Jamie Heilman <[email protected]> Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: J. Bruce Fields <[email protected]>
1 parent fb7dd0a commit 18b9a89

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

fs/nfsd/nfs4recover.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net)
15781578
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
15791579
bool running;
15801580
int retries = 10;
1581+
struct crypto_shash *tfm;
15811582

15821583
status = nfs4_cld_state_init(net);
15831584
if (status)
@@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net)
15861587
status = __nfsd4_init_cld_pipe(net);
15871588
if (status)
15881589
goto err_shutdown;
1589-
nn->cld_net->cn_tfm = crypto_alloc_shash("sha256", 0, 0);
1590-
if (IS_ERR(nn->cld_net->cn_tfm)) {
1591-
status = PTR_ERR(nn->cld_net->cn_tfm);
1592-
goto err_remove;
1593-
}
15941590

15951591
/*
15961592
* 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)
16071603
status = -ETIMEDOUT;
16081604
goto err_remove;
16091605
}
1606+
tfm = crypto_alloc_shash("sha256", 0, 0);
1607+
if (IS_ERR(tfm)) {
1608+
status = PTR_ERR(tfm);
1609+
goto err_remove;
1610+
}
1611+
nn->cld_net->cn_tfm = tfm;
16101612

16111613
status = nfsd4_cld_get_version(nn);
16121614
if (status == -EOPNOTSUPP)

0 commit comments

Comments
 (0)