Commit 402acd29e552cb80109d1d5c0ada53f634465d87

Authored by NeilBrown
Committed by Linus Torvalds
1 parent 5bd5f5812b

knfsd: avoid use of unitialised variables on error path when nfs exports

We need to zero various parts of 'exp' before any 'goto out', otherwise when
we go to free the contents...  we die.

Signed-off-by: Neil Brown <neilb@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

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

... ... @@ -469,6 +469,13 @@
469 469 nd.dentry = NULL;
470 470 exp.ex_path = NULL;
471 471  
  472 + /* fs locations */
  473 + exp.ex_fslocs.locations = NULL;
  474 + exp.ex_fslocs.locations_count = 0;
  475 + exp.ex_fslocs.migrated = 0;
  476 +
  477 + exp.ex_uuid = NULL;
  478 +
472 479 if (mesg[mlen-1] != '\n')
473 480 return -EINVAL;
474 481 mesg[mlen-1] = 0;
... ... @@ -508,13 +515,6 @@
508 515 exp.h.expiry_time = get_expiry(&mesg);
509 516 if (exp.h.expiry_time == 0)
510 517 goto out;
511   -
512   - /* fs locations */
513   - exp.ex_fslocs.locations = NULL;
514   - exp.ex_fslocs.locations_count = 0;
515   - exp.ex_fslocs.migrated = 0;
516   -
517   - exp.ex_uuid = NULL;
518 518  
519 519 /* flags */
520 520 err = get_int(&mesg, &an_int);