* [PATCH v3] nfsd: Fix cld_net->cn_tfm initialization
@ 2019-11-12 19:01 Scott Mayhew
2019-11-12 20:00 ` J. Bruce Fields
0 siblings, 1 reply; 2+ messages in thread
From: Scott Mayhew @ 2019-11-12 19:01 UTC (permalink / raw)
To: bfields, chuck.lever; +Cc: jamie, linux-nfs
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: 6ee95d1c8991 ("nfsd: add support for upcall version 2")
Reported-by: Jamie Heilman <jamie@audible.transient.net>
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
fs/nfsd/nfs4recover.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index cdc75ad4438b..c35c0ebaf722 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net)
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
bool running;
int retries = 10;
+ struct crypto_shash *tfm;
status = nfs4_cld_state_init(net);
if (status)
@@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net)
status = __nfsd4_init_cld_pipe(net);
if (status)
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
@@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net)
status = -ETIMEDOUT;
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);
if (status == -EOPNOTSUPP)
--
2.17.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v3] nfsd: Fix cld_net->cn_tfm initialization
2019-11-12 19:01 [PATCH v3] nfsd: Fix cld_net->cn_tfm initialization Scott Mayhew
@ 2019-11-12 20:00 ` J. Bruce Fields
0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2019-11-12 20:00 UTC (permalink / raw)
To: Scott Mayhew; +Cc: chuck.lever, jamie, linux-nfs
Thanks, applied.--b.
On Tue, Nov 12, 2019 at 02:01:43PM -0500, Scott Mayhew wrote:
> 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: 6ee95d1c8991 ("nfsd: add support for upcall version 2")
> Reported-by: Jamie Heilman <jamie@audible.transient.net>
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> ---
> fs/nfsd/nfs4recover.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
> index cdc75ad4438b..c35c0ebaf722 100644
> --- a/fs/nfsd/nfs4recover.c
> +++ b/fs/nfsd/nfs4recover.c
> @@ -1578,6 +1578,7 @@ nfsd4_cld_tracking_init(struct net *net)
> struct nfsd_net *nn = net_generic(net, nfsd_net_id);
> bool running;
> int retries = 10;
> + struct crypto_shash *tfm;
>
> status = nfs4_cld_state_init(net);
> if (status)
> @@ -1586,11 +1587,6 @@ nfsd4_cld_tracking_init(struct net *net)
> status = __nfsd4_init_cld_pipe(net);
> if (status)
> 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
> @@ -1607,6 +1603,12 @@ nfsd4_cld_tracking_init(struct net *net)
> status = -ETIMEDOUT;
> 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);
> if (status == -EOPNOTSUPP)
> --
> 2.17.2
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-12 20:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-12 19:01 [PATCH v3] nfsd: Fix cld_net->cn_tfm initialization Scott Mayhew
2019-11-12 20:00 ` J. Bruce Fields
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox