Commit 8b1a7f3d authored by Kinglong Mee's avatar Kinglong Mee Committed by Greg Kroah-Hartman

NFSD: Decrease nfsd_users in nfsd_startup_generic fail

commit d9499a95 upstream.

A memory allocation failure could cause nfsd_startup_generic to fail, in
which case nfsd_users wouldn't be incorrectly left elevated.

After nfsd restarts nfsd_startup_generic will then succeed without doing
anything--the first consequence is likely nfs4_start_net finding a bad
laundry_wq and crashing.
Signed-off-by: default avatarKinglong Mee <kinglongmee@gmail.com>
Fixes: 4539f149 "nfsd: replace boolean nfsd_up flag by users counter"
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 242af703
...@@ -221,7 +221,8 @@ static int nfsd_startup_generic(int nrservs) ...@@ -221,7 +221,8 @@ static int nfsd_startup_generic(int nrservs)
*/ */
ret = nfsd_racache_init(2*nrservs); ret = nfsd_racache_init(2*nrservs);
if (ret) if (ret)
return ret; goto dec_users;
ret = nfs4_state_start(); ret = nfs4_state_start();
if (ret) if (ret)
goto out_racache; goto out_racache;
...@@ -229,6 +230,8 @@ static int nfsd_startup_generic(int nrservs) ...@@ -229,6 +230,8 @@ static int nfsd_startup_generic(int nrservs)
out_racache: out_racache:
nfsd_racache_shutdown(); nfsd_racache_shutdown();
dec_users:
nfsd_users--;
return ret; return ret;
} }
......
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