aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 7ce2c6e4e23e..5cd882b8871a 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,38 +152,34 @@ 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);
155 cache_put(&ek->h, &svc_expkey_cache); 156 if (len < 0)
156 goto out; 157 goto out;
157 }
158 dprintk("Path seems to be <%s>\n", buf); 158 dprintk("Path seems to be <%s>\n", buf);
159 err = 0; 159 err = 0;
160 if (len == 0) { 160 if (len == 0) {
161 set_bit(CACHE_NEGATIVE, &key.h.flags); 161 set_bit(CACHE_NEGATIVE, &key.h.flags);
162 ek = svc_expkey_update(&key, ek); 162 ek = svc_expkey_update(&key, ek);
163 if (ek) 163 if (!ek)
164 cache_put(&ek->h, &svc_expkey_cache); 164 err = -ENOMEM;
165 else err = -ENOMEM;
166 } else { 165 } else {
167 struct nameidata nd; 166 struct nameidata nd;
168 err = path_lookup(buf, 0, &nd); 167 err = path_lookup(buf, 0, &nd);
169 if (err) { 168 if (err)
170 cache_put(&ek->h, &svc_expkey_cache);
171 goto out; 169 goto out;
172 }
173 170
174 dprintk("Found the path %s\n", buf); 171 dprintk("Found the path %s\n", buf);
175 key.ek_path = nd.path; 172 key.ek_path = nd.path;
176 173
177 ek = svc_expkey_update(&key, ek); 174 ek = svc_expkey_update(&key, ek);
178 if (ek) 175 if (!ek)
179 cache_put(&ek->h, &svc_expkey_cache);
180 else
181 err = -ENOMEM; 176 err = -ENOMEM;
182 path_put(&nd.path); 177 path_put(&nd.path);
183 } 178 }
184 cache_flush(); 179 cache_flush();
185 out: 180 out:
181 if (ek)
182 cache_put(&ek->h, &svc_expkey_cache);
186 if (dom) 183 if (dom)
187 auth_domain_put(dom); 184 auth_domain_put(dom);
188 kfree(buf); 185 kfree(buf);