aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfssvc.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2010-08-06 15:48:03 -0400
committerJ. Bruce Fields <bfields@redhat.com>2010-08-06 17:05:40 -0400
commite844a7b9805a2b74cfd34c8604f5bba3e0869305 (patch)
treef0270f65da19a0f6ebc50787dd9edce6a8def9d3 /fs/nfsd/nfssvc.c
parente2aa7f8304b3b5656ded8699216cc65138d03b64 (diff)
nfsd: initialize nfsd versions before creating svc
Commit 59db4a0c102e0de226a3395dbf25ea51bf845937 "nfsd: move more into nfsd_startup()" inadvertently moved nfsd_versions after nfsd_create_svc(). On older distributions using an rpc.nfsd that does not explicitly set the list of nfsd versions, this results in svc-create_pooled() being called with an empty versions array. The resulting incomplete initialization leads to a NULL dereference in svc_process_common() the first time a client accesses the server. Move nfsd_reset_versions() back before the svc_create_pooled(); this time, put it closer to the svc_create_pooled() call, to make this mistake more difficult in the future. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfssvc.c')
-rw-r--r--fs/nfsd/nfssvc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 39ced4a52c5f..e2c43464f237 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -224,7 +224,6 @@ static int nfsd_startup(unsigned short port, int nrservs)
224 ret = nfs4_state_start(); 224 ret = nfs4_state_start();
225 if (ret) 225 if (ret)
226 goto out_lockd; 226 goto out_lockd;
227 nfsd_reset_versions();
228 nfsd_up = true; 227 nfsd_up = true;
229 return 0; 228 return 0;
230out_lockd: 229out_lockd:
@@ -329,6 +328,7 @@ int nfsd_create_serv(void)
329 nfsd_max_blksize >= 8*1024*2) 328 nfsd_max_blksize >= 8*1024*2)
330 nfsd_max_blksize /= 2; 329 nfsd_max_blksize /= 2;
331 } 330 }
331 nfsd_reset_versions();
332 332
333 nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, 333 nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
334 nfsd_last_thread, nfsd, THIS_MODULE); 334 nfsd_last_thread, nfsd, THIS_MODULE);