]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] knfsd: Avoid use of unitialised variables on error path when nfs exports.
authorNeilBrown <neilb@suse.de>
Mon, 7 May 2007 00:35:15 +0000 (10:35 +1000)
committerChris Wright <chrisw@sous-sol.org>
Wed, 23 May 2007 21:32:44 +0000 (14:32 -0700)
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>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
fs/nfsd/export.c

index 6f24768272a1f05dcdd9657d3bb22755c06e9dce..79bd03b8bbf868e7638b1e85f90977b7727c88e6 100644 (file)
@@ -469,6 +469,13 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
        nd.dentry = 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')
                return -EINVAL;
        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)
                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 */
        err = get_int(&mesg, &an_int);
        if (err == -ENOENT)