We might as well do all of these at the end. Fix up a couple minor
style nits while we're there.
Signed-off-by: J. Bruce Fields <[email protected]>
int fsidtype;
char *ep;
struct svc_expkey key;
int fsidtype;
char *ep;
struct svc_expkey key;
+ struct svc_expkey *ek = NULL;
if (mesg[mlen-1] != '\n')
return -EINVAL;
if (mesg[mlen-1] != '\n')
return -EINVAL;
buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
err = -ENOMEM;
buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
err = -ENOMEM;
err = -EINVAL;
if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
err = -EINVAL;
if ((len=qword_get(&mesg, buf, PAGE_SIZE)) <= 0)
/* now we want a pathname, or empty meaning NEGATIVE */
err = -EINVAL;
/* now we want a pathname, or empty meaning NEGATIVE */
err = -EINVAL;
- if ((len=qword_get(&mesg, buf, PAGE_SIZE)) < 0) {
- cache_put(&ek->h, &svc_expkey_cache);
+ len = qword_get(&mesg, buf, PAGE_SIZE);
+ if (len < 0)
dprintk("Path seems to be <%s>\n", buf);
err = 0;
if (len == 0) {
set_bit(CACHE_NEGATIVE, &key.h.flags);
ek = svc_expkey_update(&key, ek);
dprintk("Path seems to be <%s>\n", buf);
err = 0;
if (len == 0) {
set_bit(CACHE_NEGATIVE, &key.h.flags);
ek = svc_expkey_update(&key, ek);
- if (ek)
- cache_put(&ek->h, &svc_expkey_cache);
- else err = -ENOMEM;
+ if (!ek)
+ err = -ENOMEM;
} else {
struct nameidata nd;
err = path_lookup(buf, 0, &nd);
} else {
struct nameidata nd;
err = path_lookup(buf, 0, &nd);
- if (err) {
- cache_put(&ek->h, &svc_expkey_cache);
dprintk("Found the path %s\n", buf);
key.ek_path = nd.path;
ek = svc_expkey_update(&key, ek);
dprintk("Found the path %s\n", buf);
key.ek_path = nd.path;
ek = svc_expkey_update(&key, ek);
- if (ek)
- cache_put(&ek->h, &svc_expkey_cache);
- else
err = -ENOMEM;
path_put(&nd.path);
}
cache_flush();
out:
err = -ENOMEM;
path_put(&nd.path);
}
cache_flush();
out:
+ if (ek)
+ cache_put(&ek->h, &svc_expkey_cache);
if (dom)
auth_domain_put(dom);
kfree(buf);
if (dom)
auth_domain_put(dom);
kfree(buf);