Browse Source

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>
NeilBrown 18 years ago
parent
commit
402acd29e5
1 changed files with 7 additions and 7 deletions
  1. 7 7
      fs/nfsd/export.c

+ 7 - 7
fs/nfsd/export.c

@@ -469,6 +469,13 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
 	nd.dentry = NULL;
 	nd.dentry = NULL;
 	exp.ex_path = NULL;
 	exp.ex_path = NULL;
 
 
+	/* fs locations */
+	exp.ex_fslocs.locations = NULL;
+	exp.ex_fslocs.locations_count = 0;
+	exp.ex_fslocs.migrated = 0;
+
+	exp.ex_uuid = NULL;
+
 	if (mesg[mlen-1] != '\n')
 	if (mesg[mlen-1] != '\n')
 		return -EINVAL;
 		return -EINVAL;
 	mesg[mlen-1] = 0;
 	mesg[mlen-1] = 0;
@@ -509,13 +516,6 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
 	if (exp.h.expiry_time == 0)
 	if (exp.h.expiry_time == 0)
 		goto out;
 		goto out;
 
 
-	/* fs locations */
-	exp.ex_fslocs.locations = NULL;
-	exp.ex_fslocs.locations_count = 0;
-	exp.ex_fslocs.migrated = 0;
-
-	exp.ex_uuid = NULL;
-
 	/* flags */
 	/* flags */
 	err = get_int(&mesg, &an_int);
 	err = get_int(&mesg, &an_int);
 	if (err == -ENOENT)
 	if (err == -ENOENT)