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.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 9dc036f18356..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,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 struct nameidata nd; 166 struct nameidata nd;
166 err = path_lookup(buf, 0, &nd); 167 err = path_lookup(buf, 0, &nd);
@@ -171,14 +172,14 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
171 key.ek_path = nd.path; 172 key.ek_path = nd.path;
172 173
173 ek = svc_expkey_update(&key, ek); 174 ek = svc_expkey_update(&key, ek);
174 if (ek) 175 if (!ek)
175 cache_put(&ek->h, &svc_expkey_cache);
176 else
177 err = -ENOMEM; 176 err = -ENOMEM;
178 path_put(&nd.path); 177 path_put(&nd.path);
179 } 178 }
180 cache_flush(); 179 cache_flush();
181 out: 180 out:
181 if (ek)
182 cache_put(&ek->h, &svc_expkey_cache);
182 if (dom) 183 if (dom)
183 auth_domain_put(dom); 184 auth_domain_put(dom);
184 kfree(buf); 185 kfree(buf);