Commit 5870963f authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'nfsd-6.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux

Pull nfsd fixes from Chuck Lever:

 - Fix NFSD bring-up / shutdown

 - Fix a UAF when releasing a stateid

* tag 'nfsd-6.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  nfsd: fix possible badness in FREE_STATEID
  nfsd: nfsd_destroy_serv() must call svc_destroy() even if nfsd_startup_net() failed
  NFSD: Mark filecache "down" if init fails
parents 825ec756 c88c150a
...@@ -751,7 +751,7 @@ nfsd_file_cache_init(void) ...@@ -751,7 +751,7 @@ nfsd_file_cache_init(void)
ret = rhltable_init(&nfsd_file_rhltable, &nfsd_file_rhash_params); ret = rhltable_init(&nfsd_file_rhltable, &nfsd_file_rhash_params);
if (ret) if (ret)
return ret; goto out;
ret = -ENOMEM; ret = -ENOMEM;
nfsd_file_slab = KMEM_CACHE(nfsd_file, 0); nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
...@@ -803,6 +803,8 @@ nfsd_file_cache_init(void) ...@@ -803,6 +803,8 @@ nfsd_file_cache_init(void)
INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker); INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker);
out: out:
if (ret)
clear_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags);
return ret; return ret;
out_notifier: out_notifier:
lease_unregister_notifier(&nfsd_file_lease_notifier); lease_unregister_notifier(&nfsd_file_lease_notifier);
......
...@@ -7154,6 +7154,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, ...@@ -7154,6 +7154,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
switch (s->sc_type) { switch (s->sc_type) {
case SC_TYPE_DELEG: case SC_TYPE_DELEG:
if (s->sc_status & SC_STATUS_REVOKED) { if (s->sc_status & SC_STATUS_REVOKED) {
s->sc_status |= SC_STATUS_CLOSED;
spin_unlock(&s->sc_lock); spin_unlock(&s->sc_lock);
dp = delegstateid(s); dp = delegstateid(s);
list_del_init(&dp->dl_recall_lru); list_del_init(&dp->dl_recall_lru);
......
...@@ -434,6 +434,9 @@ static void nfsd_shutdown_net(struct net *net) ...@@ -434,6 +434,9 @@ static void nfsd_shutdown_net(struct net *net)
{ {
struct nfsd_net *nn = net_generic(net, nfsd_net_id); struct nfsd_net *nn = net_generic(net, nfsd_net_id);
if (!nn->nfsd_net_up)
return;
nfsd_export_flush(net);
nfs4_state_shutdown_net(net); nfs4_state_shutdown_net(net);
nfsd_reply_cache_shutdown(nn); nfsd_reply_cache_shutdown(nn);
nfsd_file_cache_shutdown_net(net); nfsd_file_cache_shutdown_net(net);
...@@ -549,11 +552,8 @@ void nfsd_destroy_serv(struct net *net) ...@@ -549,11 +552,8 @@ void nfsd_destroy_serv(struct net *net)
* other initialization has been done except the rpcb information. * other initialization has been done except the rpcb information.
*/ */
svc_rpcb_cleanup(serv, net); svc_rpcb_cleanup(serv, net);
if (!nn->nfsd_net_up)
return;
nfsd_shutdown_net(net); nfsd_shutdown_net(net);
nfsd_export_flush(net);
svc_destroy(&serv); svc_destroy(&serv);
} }
......
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