Skip to content

Commit e0011bc

Browse files
neilbrownchucklever
authored andcommitted
nfsd: initialise nfsd_info.mutex early.
nfsd_info.mutex can be dereferenced by svc_pool_stats_start() immediately after the new netns is created. Currently this can trigger an oops. Move the initialisation earlier before it can possibly be dereferenced. Fixes: 7b207cc ("svc: don't hold reference for poolstats, only mutex.") Reported-by: Sourabh Jain <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: NeilBrown <[email protected]> Reviewed-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent da2c8fe commit e0011bc

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

fs/nfsd/nfsctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2169,6 +2169,8 @@ static __net_init int nfsd_net_init(struct net *net)
21692169
nn->nfsd_svcstats.program = &nfsd_program;
21702170
nn->nfsd_versions = NULL;
21712171
nn->nfsd4_minorversions = NULL;
2172+
nn->nfsd_info.mutex = &nfsd_mutex;
2173+
nn->nfsd_serv = NULL;
21722174
nfsd4_init_leases_net(nn);
21732175
get_random_bytes(&nn->siphash_key, sizeof(nn->siphash_key));
21742176
seqlock_init(&nn->writeverf_lock);

fs/nfsd/nfssvc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,6 @@ int nfsd_create_serv(struct net *net)
672672
return error;
673673
}
674674
spin_lock(&nfsd_notifier_lock);
675-
nn->nfsd_info.mutex = &nfsd_mutex;
676675
nn->nfsd_serv = serv;
677676
spin_unlock(&nfsd_notifier_lock);
678677

0 commit comments

Comments
 (0)