diff options
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r-- | fs/ecryptfs/crypto.c | 2 | ||||
-rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 2 | ||||
-rw-r--r-- | fs/ecryptfs/miscdev.c | 26 | ||||
-rw-r--r-- | fs/ecryptfs/read_write.c | 22 |
4 files changed, 13 insertions, 39 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index cd62d75b2cc0..e2832bc7869a 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1906,9 +1906,9 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, | |||
1906 | goto out; | 1906 | goto out; |
1907 | } | 1907 | } |
1908 | } | 1908 | } |
1909 | mutex_unlock(&key_tfm_list_mutex); | ||
1910 | (*tfm) = key_tfm->key_tfm; | 1909 | (*tfm) = key_tfm->key_tfm; |
1911 | (*tfm_mutex) = &key_tfm->key_tfm_mutex; | 1910 | (*tfm_mutex) = &key_tfm->key_tfm_mutex; |
1912 | out: | 1911 | out: |
1912 | mutex_unlock(&key_tfm_list_mutex); | ||
1913 | return rc; | 1913 | return rc; |
1914 | } | 1914 | } |
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 951ee33a022d..c15c25745e05 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h | |||
@@ -660,8 +660,6 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, | |||
660 | int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key, | 660 | int ecryptfs_keyring_auth_tok_for_sig(struct key **auth_tok_key, |
661 | struct ecryptfs_auth_tok **auth_tok, | 661 | struct ecryptfs_auth_tok **auth_tok, |
662 | char *sig); | 662 | char *sig); |
663 | int ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, | ||
664 | int num_zeros); | ||
665 | int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, | 663 | int ecryptfs_write_lower(struct inode *ecryptfs_inode, char *data, |
666 | loff_t offset, size_t size); | 664 | loff_t offset, size_t size); |
667 | int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, | 665 | int ecryptfs_write_lower_page_segment(struct inode *ecryptfs_inode, |
diff --git a/fs/ecryptfs/miscdev.c b/fs/ecryptfs/miscdev.c index 6560da1a58ce..50c994a249a5 100644 --- a/fs/ecryptfs/miscdev.c +++ b/fs/ecryptfs/miscdev.c | |||
@@ -243,7 +243,6 @@ ecryptfs_miscdev_read(struct file *file, char __user *buf, size_t count, | |||
243 | struct ecryptfs_daemon *daemon; | 243 | struct ecryptfs_daemon *daemon; |
244 | struct ecryptfs_msg_ctx *msg_ctx; | 244 | struct ecryptfs_msg_ctx *msg_ctx; |
245 | size_t packet_length_size; | 245 | size_t packet_length_size; |
246 | u32 counter_nbo; | ||
247 | char packet_length[3]; | 246 | char packet_length[3]; |
248 | size_t i; | 247 | size_t i; |
249 | size_t total_length; | 248 | size_t total_length; |
@@ -328,20 +327,18 @@ check_list: | |||
328 | "pending message\n", __func__, count, total_length); | 327 | "pending message\n", __func__, count, total_length); |
329 | goto out_unlock_msg_ctx; | 328 | goto out_unlock_msg_ctx; |
330 | } | 329 | } |
331 | i = 0; | 330 | rc = -EFAULT; |
332 | buf[i++] = msg_ctx->type; | 331 | if (put_user(msg_ctx->type, buf)) |
333 | counter_nbo = cpu_to_be32(msg_ctx->counter); | 332 | goto out_unlock_msg_ctx; |
334 | memcpy(&buf[i], (char *)&counter_nbo, 4); | 333 | if (put_user(cpu_to_be32(msg_ctx->counter), (__be32 __user *)(buf + 1))) |
335 | i += 4; | 334 | goto out_unlock_msg_ctx; |
335 | i = 5; | ||
336 | if (msg_ctx->msg) { | 336 | if (msg_ctx->msg) { |
337 | memcpy(&buf[i], packet_length, packet_length_size); | 337 | if (copy_to_user(&buf[i], packet_length, packet_length_size)) |
338 | goto out_unlock_msg_ctx; | ||
338 | i += packet_length_size; | 339 | i += packet_length_size; |
339 | rc = copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size); | 340 | if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size)) |
340 | if (rc) { | ||
341 | printk(KERN_ERR "%s: copy_to_user returned error " | ||
342 | "[%d]\n", __func__, rc); | ||
343 | goto out_unlock_msg_ctx; | 341 | goto out_unlock_msg_ctx; |
344 | } | ||
345 | i += msg_ctx->msg_size; | 342 | i += msg_ctx->msg_size; |
346 | } | 343 | } |
347 | rc = i; | 344 | rc = i; |
@@ -452,7 +449,8 @@ static ssize_t | |||
452 | ecryptfs_miscdev_write(struct file *file, const char __user *buf, | 449 | ecryptfs_miscdev_write(struct file *file, const char __user *buf, |
453 | size_t count, loff_t *ppos) | 450 | size_t count, loff_t *ppos) |
454 | { | 451 | { |
455 | u32 counter_nbo, seq; | 452 | __be32 counter_nbo; |
453 | u32 seq; | ||
456 | size_t packet_size, packet_size_length, i; | 454 | size_t packet_size, packet_size_length, i; |
457 | ssize_t sz = 0; | 455 | ssize_t sz = 0; |
458 | char *data; | 456 | char *data; |
@@ -485,7 +483,7 @@ ecryptfs_miscdev_write(struct file *file, const char __user *buf, | |||
485 | count); | 483 | count); |
486 | goto out_free; | 484 | goto out_free; |
487 | } | 485 | } |
488 | memcpy((char *)&counter_nbo, &data[i], 4); | 486 | memcpy(&counter_nbo, &data[i], 4); |
489 | seq = be32_to_cpu(counter_nbo); | 487 | seq = be32_to_cpu(counter_nbo); |
490 | i += 4; | 488 | i += 4; |
491 | rc = ecryptfs_parse_packet_length(&data[i], &packet_size, | 489 | rc = ecryptfs_parse_packet_length(&data[i], &packet_size, |
diff --git a/fs/ecryptfs/read_write.c b/fs/ecryptfs/read_write.c index ebf55150be56..75c2ea9fee35 100644 --- a/fs/ecryptfs/read_write.c +++ b/fs/ecryptfs/read_write.c | |||
@@ -157,20 +157,6 @@ int ecryptfs_write(struct file *ecryptfs_file, char *data, loff_t offset, | |||
157 | ecryptfs_page_idx, rc); | 157 | ecryptfs_page_idx, rc); |
158 | goto out; | 158 | goto out; |
159 | } | 159 | } |
160 | if (start_offset_in_page) { | ||
161 | /* Read in the page from the lower | ||
162 | * into the eCryptfs inode page cache, | ||
163 | * decrypting */ | ||
164 | rc = ecryptfs_decrypt_page(ecryptfs_page); | ||
165 | if (rc) { | ||
166 | printk(KERN_ERR "%s: Error decrypting " | ||
167 | "page; rc = [%d]\n", | ||
168 | __func__, rc); | ||
169 | ClearPageUptodate(ecryptfs_page); | ||
170 | page_cache_release(ecryptfs_page); | ||
171 | goto out; | ||
172 | } | ||
173 | } | ||
174 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); | 160 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); |
175 | 161 | ||
176 | /* | 162 | /* |
@@ -349,14 +335,6 @@ int ecryptfs_read(char *data, loff_t offset, size_t size, | |||
349 | ecryptfs_page_idx, rc); | 335 | ecryptfs_page_idx, rc); |
350 | goto out; | 336 | goto out; |
351 | } | 337 | } |
352 | rc = ecryptfs_decrypt_page(ecryptfs_page); | ||
353 | if (rc) { | ||
354 | printk(KERN_ERR "%s: Error decrypting " | ||
355 | "page; rc = [%d]\n", __func__, rc); | ||
356 | ClearPageUptodate(ecryptfs_page); | ||
357 | page_cache_release(ecryptfs_page); | ||
358 | goto out; | ||
359 | } | ||
360 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); | 338 | ecryptfs_page_virt = kmap_atomic(ecryptfs_page, KM_USER0); |
361 | memcpy((data + data_offset), | 339 | memcpy((data + data_offset), |
362 | ((char *)ecryptfs_page_virt + start_offset_in_page), | 340 | ((char *)ecryptfs_page_virt + start_offset_in_page), |