aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfsd/export.c19
-rw-r--r--fs/nfsd/nfssvc.c4
-rw-r--r--fs/nfsd/vfs.c6
3 files changed, 19 insertions, 10 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);
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 59eeb46f82c5..07e4f5d7baa8 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -249,6 +249,10 @@ static int nfsd_init_socks(int port)
249 if (error < 0) 249 if (error < 0)
250 return error; 250 return error;
251 251
252 error = lockd_up();
253 if (error < 0)
254 return error;
255
252 error = svc_create_xprt(nfsd_serv, "tcp", port, 256 error = svc_create_xprt(nfsd_serv, "tcp", port,
253 SVC_SOCK_DEFAULTS); 257 SVC_SOCK_DEFAULTS);
254 if (error < 0) 258 if (error < 0)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index aa1d0d6489a1..9609eb51d727 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -410,6 +410,7 @@ out_nfserr:
410static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf) 410static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
411{ 411{
412 ssize_t buflen; 412 ssize_t buflen;
413 ssize_t ret;
413 414
414 buflen = vfs_getxattr(dentry, key, NULL, 0); 415 buflen = vfs_getxattr(dentry, key, NULL, 0);
415 if (buflen <= 0) 416 if (buflen <= 0)
@@ -419,7 +420,10 @@ static ssize_t nfsd_getxattr(struct dentry *dentry, char *key, void **buf)
419 if (!*buf) 420 if (!*buf)
420 return -ENOMEM; 421 return -ENOMEM;
421 422
422 return vfs_getxattr(dentry, key, *buf, buflen); 423 ret = vfs_getxattr(dentry, key, *buf, buflen);
424 if (ret < 0)
425 kfree(*buf);
426 return ret;
423} 427}
424#endif 428#endif
425 429