Skip to content

Commit 5870963

Browse files
committed
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
2 parents 825ec75 + c88c150 commit 5870963

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

fs/nfsd/filecache.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ nfsd_file_cache_init(void)
751751

752752
ret = rhltable_init(&nfsd_file_rhltable, &nfsd_file_rhash_params);
753753
if (ret)
754-
return ret;
754+
goto out;
755755

756756
ret = -ENOMEM;
757757
nfsd_file_slab = KMEM_CACHE(nfsd_file, 0);
@@ -803,6 +803,8 @@ nfsd_file_cache_init(void)
803803

804804
INIT_DELAYED_WORK(&nfsd_filecache_laundrette, nfsd_file_gc_worker);
805805
out:
806+
if (ret)
807+
clear_bit(NFSD_FILE_CACHE_UP, &nfsd_file_flags);
806808
return ret;
807809
out_notifier:
808810
lease_unregister_notifier(&nfsd_file_lease_notifier);

fs/nfsd/nfs4state.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7154,6 +7154,7 @@ nfsd4_free_stateid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
71547154
switch (s->sc_type) {
71557155
case SC_TYPE_DELEG:
71567156
if (s->sc_status & SC_STATUS_REVOKED) {
7157+
s->sc_status |= SC_STATUS_CLOSED;
71577158
spin_unlock(&s->sc_lock);
71587159
dp = delegstateid(s);
71597160
list_del_init(&dp->dl_recall_lru);

fs/nfsd/nfssvc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,9 @@ static void nfsd_shutdown_net(struct net *net)
434434
{
435435
struct nfsd_net *nn = net_generic(net, nfsd_net_id);
436436

437+
if (!nn->nfsd_net_up)
438+
return;
439+
nfsd_export_flush(net);
437440
nfs4_state_shutdown_net(net);
438441
nfsd_reply_cache_shutdown(nn);
439442
nfsd_file_cache_shutdown_net(net);
@@ -549,11 +552,8 @@ void nfsd_destroy_serv(struct net *net)
549552
* other initialization has been done except the rpcb information.
550553
*/
551554
svc_rpcb_cleanup(serv, net);
552-
if (!nn->nfsd_net_up)
553-
return;
554555

555556
nfsd_shutdown_net(net);
556-
nfsd_export_flush(net);
557557
svc_destroy(&serv);
558558
}
559559

0 commit comments

Comments
 (0)