diff options
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r-- | fs/nfsd/export.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index 676201dbdf8..5839b229cd0 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c | |||
@@ -99,7 +99,7 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
99 | int fsidtype; | 99 | int fsidtype; |
100 | char *ep; | 100 | char *ep; |
101 | struct svc_expkey key; | 101 | struct svc_expkey key; |
102 | struct svc_expkey *ek; | 102 | struct svc_expkey *ek = NULL; |
103 | 103 | ||
104 | if (mesg[mlen-1] != '\n') | 104 | if (mesg[mlen-1] != '\n') |
105 | return -EINVAL; | 105 | return -EINVAL; |
@@ -107,7 +107,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
107 | 107 | ||
108 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | 108 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
109 | err = -ENOMEM; | 109 | err = -ENOMEM; |
110 | if (!buf) goto out; | 110 | if (!buf) |
111 | goto out; | ||
111 | 112 | ||
112 | err = -EINVAL; | 113 | err = -EINVAL; |
113 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) | 114 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0) |
@@ -151,16 +152,16 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
151 | 152 | ||
152 | /* now we want a pathname, or empty meaning NEGATIVE */ | 153 | /* now we want a pathname, or empty meaning NEGATIVE */ |
153 | err = -EINVAL; | 154 | err = -EINVAL; |
154 | if ((len=qword_get(&mesg, buf, PAGE_SIZE)) < 0) | 155 | len = qword_get(&mesg, buf, PAGE_SIZE); |
156 | if (len < 0) | ||
155 | goto out; | 157 | goto out; |
156 | dprintk("Path seems to be <%s>\n", buf); | 158 | dprintk("Path seems to be <%s>\n", buf); |
157 | err = 0; | 159 | err = 0; |
158 | if (len == 0) { | 160 | if (len == 0) { |
159 | set_bit(CACHE_NEGATIVE, &key.h.flags); | 161 | set_bit(CACHE_NEGATIVE, &key.h.flags); |
160 | ek = svc_expkey_update(&key, ek); | 162 | ek = svc_expkey_update(&key, ek); |
161 | if (ek) | 163 | if (!ek) |
162 | cache_put(&ek->h, &svc_expkey_cache); | 164 | err = -ENOMEM; |
163 | else err = -ENOMEM; | ||
164 | } else { | 165 | } else { |
165 | err = kern_path(buf, 0, &key.ek_path); | 166 | err = kern_path(buf, 0, &key.ek_path); |
166 | if (err) | 167 | if (err) |
@@ -169,14 +170,14 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen) | |||
169 | dprintk("Found the path %s\n", buf); | 170 | dprintk("Found the path %s\n", buf); |
170 | 171 | ||
171 | ek = svc_expkey_update(&key, ek); | 172 | ek = svc_expkey_update(&key, ek); |
172 | if (ek) | 173 | if (!ek) |
173 | cache_put(&ek->h, &svc_expkey_cache); | ||
174 | else | ||
175 | err = -ENOMEM; | 174 | err = -ENOMEM; |
176 | path_put(&key.ek_path); | 175 | path_put(&key.ek_path); |
177 | } | 176 | } |
178 | cache_flush(); | 177 | cache_flush(); |
179 | out: | 178 | out: |
179 | if (ek) | ||
180 | cache_put(&ek->h, &svc_expkey_cache); | ||
180 | if (dom) | 181 | if (dom) |
181 | auth_domain_put(dom); | 182 | auth_domain_put(dom); |
182 | kfree(buf); | 183 | kfree(buf); |