Commit d9499a95716db0d4bc9b67e88fd162133e7d6b08

Authored by Kinglong Mee
Committed by J. Bruce Fields
1 parent 4ae098d327

NFSD: Decrease nfsd_users in nfsd_startup_generic fail

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: Kinglong Mee <kinglongmee@gmail.com>
Fixes: 4539f14981ce "nfsd: replace boolean nfsd_up flag by users counter"
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>

Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff

... ... @@ -221,7 +221,8 @@
221 221 */
222 222 ret = nfsd_racache_init(2*nrservs);
223 223 if (ret)
224   - return ret;
  224 + goto dec_users;
  225 +
225 226 ret = nfs4_state_start();
226 227 if (ret)
227 228 goto out_racache;
... ... @@ -229,6 +230,8 @@
229 230  
230 231 out_racache:
231 232 nfsd_racache_shutdown();
  233 +dec_users:
  234 + nfsd_users--;
232 235 return ret;
233 236 }
234 237