diff options
Diffstat (limited to 'fs/ecryptfs')
| -rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 4 | ||||
| -rw-r--r-- | fs/ecryptfs/file.c | 34 | ||||
| -rw-r--r-- | fs/ecryptfs/keystore.c | 2 | ||||
| -rw-r--r-- | fs/ecryptfs/main.c | 2 |
4 files changed, 34 insertions, 8 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 90d1882b306f..5ba029e627cc 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
| @@ -124,7 +124,7 @@ ecryptfs_get_key_payload_data(struct key *key) | |||
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | #define ECRYPTFS_MAX_KEYSET_SIZE 1024 | 126 | #define ECRYPTFS_MAX_KEYSET_SIZE 1024 |
| 127 | #define ECRYPTFS_MAX_CIPHER_NAME_SIZE 32 | 127 | #define ECRYPTFS_MAX_CIPHER_NAME_SIZE 31 |
| 128 | #define ECRYPTFS_MAX_NUM_ENC_KEYS 64 | 128 | #define ECRYPTFS_MAX_NUM_ENC_KEYS 64 |
| 129 | #define ECRYPTFS_MAX_IV_BYTES 16 /* 128 bits */ | 129 | #define ECRYPTFS_MAX_IV_BYTES 16 /* 128 bits */ |
| 130 | #define ECRYPTFS_SALT_BYTES 2 | 130 | #define ECRYPTFS_SALT_BYTES 2 |
| @@ -237,7 +237,7 @@ struct ecryptfs_crypt_stat { | |||
| 237 | struct crypto_ablkcipher *tfm; | 237 | struct crypto_ablkcipher *tfm; |
| 238 | struct crypto_hash *hash_tfm; /* Crypto context for generating | 238 | struct crypto_hash *hash_tfm; /* Crypto context for generating |
| 239 | * the initialization vectors */ | 239 | * the initialization vectors */ |
| 240 | unsigned char cipher[ECRYPTFS_MAX_CIPHER_NAME_SIZE]; | 240 | unsigned char cipher[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1]; |
| 241 | unsigned char key[ECRYPTFS_MAX_KEY_BYTES]; | 241 | unsigned char key[ECRYPTFS_MAX_KEY_BYTES]; |
| 242 | unsigned char root_iv[ECRYPTFS_MAX_IV_BYTES]; | 242 | unsigned char root_iv[ECRYPTFS_MAX_IV_BYTES]; |
| 243 | struct list_head keysig_list; | 243 | struct list_head keysig_list; |
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index b07731e68c0b..fd39bad6f1bd 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c | |||
| @@ -303,9 +303,22 @@ ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 303 | struct file *lower_file = ecryptfs_file_to_lower(file); | 303 | struct file *lower_file = ecryptfs_file_to_lower(file); |
| 304 | long rc = -ENOTTY; | 304 | long rc = -ENOTTY; |
| 305 | 305 | ||
| 306 | if (lower_file->f_op->unlocked_ioctl) | 306 | if (!lower_file->f_op->unlocked_ioctl) |
| 307 | return rc; | ||
| 308 | |||
| 309 | switch (cmd) { | ||
| 310 | case FITRIM: | ||
| 311 | case FS_IOC_GETFLAGS: | ||
| 312 | case FS_IOC_SETFLAGS: | ||
| 313 | case FS_IOC_GETVERSION: | ||
| 314 | case FS_IOC_SETVERSION: | ||
| 307 | rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); | 315 | rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); |
| 308 | return rc; | 316 | fsstack_copy_attr_all(file_inode(file), file_inode(lower_file)); |
| 317 | |||
| 318 | return rc; | ||
| 319 | default: | ||
| 320 | return rc; | ||
| 321 | } | ||
| 309 | } | 322 | } |
| 310 | 323 | ||
| 311 | #ifdef CONFIG_COMPAT | 324 | #ifdef CONFIG_COMPAT |
| @@ -315,9 +328,22 @@ ecryptfs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 315 | struct file *lower_file = ecryptfs_file_to_lower(file); | 328 | struct file *lower_file = ecryptfs_file_to_lower(file); |
| 316 | long rc = -ENOIOCTLCMD; | 329 | long rc = -ENOIOCTLCMD; |
| 317 | 330 | ||
| 318 | if (lower_file->f_op->compat_ioctl) | 331 | if (!lower_file->f_op->compat_ioctl) |
| 332 | return rc; | ||
| 333 | |||
| 334 | switch (cmd) { | ||
| 335 | case FITRIM: | ||
| 336 | case FS_IOC32_GETFLAGS: | ||
| 337 | case FS_IOC32_SETFLAGS: | ||
| 338 | case FS_IOC32_GETVERSION: | ||
| 339 | case FS_IOC32_SETVERSION: | ||
| 319 | rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); | 340 | rc = lower_file->f_op->compat_ioctl(lower_file, cmd, arg); |
| 320 | return rc; | 341 | fsstack_copy_attr_all(file_inode(file), file_inode(lower_file)); |
| 342 | |||
| 343 | return rc; | ||
| 344 | default: | ||
| 345 | return rc; | ||
| 346 | } | ||
| 321 | } | 347 | } |
| 322 | #endif | 348 | #endif |
| 323 | 349 | ||
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 917bd5c9776a..6bd67e2011f0 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c | |||
| @@ -891,7 +891,7 @@ struct ecryptfs_parse_tag_70_packet_silly_stack { | |||
| 891 | struct blkcipher_desc desc; | 891 | struct blkcipher_desc desc; |
| 892 | char fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; | 892 | char fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; |
| 893 | char iv[ECRYPTFS_MAX_IV_BYTES]; | 893 | char iv[ECRYPTFS_MAX_IV_BYTES]; |
| 894 | char cipher_string[ECRYPTFS_MAX_CIPHER_NAME_SIZE]; | 894 | char cipher_string[ECRYPTFS_MAX_CIPHER_NAME_SIZE + 1]; |
| 895 | }; | 895 | }; |
| 896 | 896 | ||
| 897 | /** | 897 | /** |
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c index 1895d60f4122..c095d3264259 100644 --- a/fs/ecryptfs/main.c +++ b/fs/ecryptfs/main.c | |||
| @@ -407,7 +407,7 @@ static int ecryptfs_parse_options(struct ecryptfs_sb_info *sbi, char *options, | |||
| 407 | if (!cipher_name_set) { | 407 | if (!cipher_name_set) { |
| 408 | int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER); | 408 | int cipher_name_len = strlen(ECRYPTFS_DEFAULT_CIPHER); |
| 409 | 409 | ||
| 410 | BUG_ON(cipher_name_len >= ECRYPTFS_MAX_CIPHER_NAME_SIZE); | 410 | BUG_ON(cipher_name_len > ECRYPTFS_MAX_CIPHER_NAME_SIZE); |
| 411 | strcpy(mount_crypt_stat->global_default_cipher_name, | 411 | strcpy(mount_crypt_stat->global_default_cipher_name, |
| 412 | ECRYPTFS_DEFAULT_CIPHER); | 412 | ECRYPTFS_DEFAULT_CIPHER); |
| 413 | } | 413 | } |
