((iname->name[1] == '.') && (iname->len == 2))))) {
fname->disk_name.name = (unsigned char *) iname->name;
fname->disk_name.len = iname->len;
- goto out;
+ return 0;
}
ret = ext4_get_encryption_info(dir);
if (ret)
ret = ext4_fname_crypto_alloc_buffer(dir, iname->len,
&fname->crypto_buf);
if (ret < 0)
- goto out;
+ return ret;
ret = ext4_fname_encrypt(dir, iname, &fname->crypto_buf);
if (ret < 0)
- goto out;
+ goto errout;
fname->disk_name.name = fname->crypto_buf.name;
fname->disk_name.len = fname->crypto_buf.len;
- ret = 0;
- goto out;
- }
- if (!lookup) {
- ret = -EACCES;
- goto out;
+ return 0;
}
+ if (!lookup)
+ return -EACCES;
/* We don't have the key and we are doing a lookup; decode the
* user-supplied name
if (iname->name[0] == '_')
bigname = 1;
if ((bigname && (iname->len != 33)) ||
- (!bigname && (iname->len > 43))) {
- ret = -ENOENT;
- }
+ (!bigname && (iname->len > 43)))
+ return -ENOENT;
+
fname->crypto_buf.name = kmalloc(32, GFP_KERNEL);
- if (fname->crypto_buf.name == NULL) {
- ret = -ENOMEM;
- goto out;
- }
+ if (fname->crypto_buf.name == NULL)
+ return -ENOMEM;
ret = digest_decode(iname->name + bigname, iname->len - bigname,
fname->crypto_buf.name);
if (ret < 0) {
ret = -ENOENT;
- goto out;
+ goto errout;
}
fname->crypto_buf.len = ret;
if (bigname) {
fname->disk_name.name = fname->crypto_buf.name;
fname->disk_name.len = fname->crypto_buf.len;
}
- ret = 0;
-out:
+ return 0;
+errout:
+ kfree(fname->crypto_buf.name);
+ fname->crypto_buf.name = NULL;
return ret;
}