Commit e844a7b9 authored by J. Bruce Fields's avatar J. Bruce Fields

nfsd: initialize nfsd versions before creating svc

Commit 59db4a0c "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: default avatarJ. Bruce Fields <bfields@redhat.com>
parent e2aa7f83
...@@ -224,7 +224,6 @@ static int nfsd_startup(unsigned short port, int nrservs) ...@@ -224,7 +224,6 @@ static int nfsd_startup(unsigned short port, int nrservs)
ret = nfs4_state_start(); ret = nfs4_state_start();
if (ret) if (ret)
goto out_lockd; goto out_lockd;
nfsd_reset_versions();
nfsd_up = true; nfsd_up = true;
return 0; return 0;
out_lockd: out_lockd:
...@@ -329,6 +328,7 @@ int nfsd_create_serv(void) ...@@ -329,6 +328,7 @@ int nfsd_create_serv(void)
nfsd_max_blksize >= 8*1024*2) nfsd_max_blksize >= 8*1024*2)
nfsd_max_blksize /= 2; nfsd_max_blksize /= 2;
} }
nfsd_reset_versions();
nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize, nfsd_serv = svc_create_pooled(&nfsd_program, nfsd_max_blksize,
nfsd_last_thread, nfsd, THIS_MODULE); nfsd_last_thread, nfsd, THIS_MODULE);
......
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