diff options
-rw-r--r-- | fs/ecryptfs/crypto.c | 2 | ||||
-rw-r--r-- | fs/ecryptfs/kthread.c | 6 | ||||
-rw-r--r-- | fs/ecryptfs/mmap.c | 12 |
3 files changed, 14 insertions, 6 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c index ea9931281557..a7b0c2dfb3db 100644 --- a/fs/ecryptfs/crypto.c +++ b/fs/ecryptfs/crypto.c | |||
@@ -1935,7 +1935,7 @@ static const unsigned char filename_rev_map[256] = { | |||
1935 | * @src: Source location for the filename to encode | 1935 | * @src: Source location for the filename to encode |
1936 | * @src_size: Size of the source in bytes | 1936 | * @src_size: Size of the source in bytes |
1937 | */ | 1937 | */ |
1938 | void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, | 1938 | static void ecryptfs_encode_for_filename(unsigned char *dst, size_t *dst_size, |
1939 | unsigned char *src, size_t src_size) | 1939 | unsigned char *src, size_t src_size) |
1940 | { | 1940 | { |
1941 | size_t num_blocks; | 1941 | size_t num_blocks; |
diff --git a/fs/ecryptfs/kthread.c b/fs/ecryptfs/kthread.c index 809e67d05ca3..f1ea610362c6 100644 --- a/fs/ecryptfs/kthread.c +++ b/fs/ecryptfs/kthread.c | |||
@@ -102,12 +102,12 @@ int __init ecryptfs_init_kthread(void) | |||
102 | 102 | ||
103 | void ecryptfs_destroy_kthread(void) | 103 | void ecryptfs_destroy_kthread(void) |
104 | { | 104 | { |
105 | struct ecryptfs_open_req *req; | 105 | struct ecryptfs_open_req *req, *tmp; |
106 | 106 | ||
107 | mutex_lock(&ecryptfs_kthread_ctl.mux); | 107 | mutex_lock(&ecryptfs_kthread_ctl.mux); |
108 | ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; | 108 | ecryptfs_kthread_ctl.flags |= ECRYPTFS_KTHREAD_ZOMBIE; |
109 | list_for_each_entry(req, &ecryptfs_kthread_ctl.req_list, | 109 | list_for_each_entry_safe(req, tmp, &ecryptfs_kthread_ctl.req_list, |
110 | kthread_ctl_list) { | 110 | kthread_ctl_list) { |
111 | list_del(&req->kthread_ctl_list); | 111 | list_del(&req->kthread_ctl_list); |
112 | *req->lower_file = ERR_PTR(-EIO); | 112 | *req->lower_file = ERR_PTR(-EIO); |
113 | complete(&req->done); | 113 | complete(&req->done); |
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c index bd1d57f98f74..564a1fa34b99 100644 --- a/fs/ecryptfs/mmap.c +++ b/fs/ecryptfs/mmap.c | |||
@@ -338,7 +338,8 @@ static int ecryptfs_write_begin(struct file *file, | |||
338 | if (prev_page_end_size | 338 | if (prev_page_end_size |
339 | >= i_size_read(page->mapping->host)) { | 339 | >= i_size_read(page->mapping->host)) { |
340 | zero_user(page, 0, PAGE_CACHE_SIZE); | 340 | zero_user(page, 0, PAGE_CACHE_SIZE); |
341 | } else { | 341 | SetPageUptodate(page); |
342 | } else if (len < PAGE_CACHE_SIZE) { | ||
342 | rc = ecryptfs_decrypt_page(page); | 343 | rc = ecryptfs_decrypt_page(page); |
343 | if (rc) { | 344 | if (rc) { |
344 | printk(KERN_ERR "%s: Error decrypting " | 345 | printk(KERN_ERR "%s: Error decrypting " |
@@ -348,8 +349,8 @@ static int ecryptfs_write_begin(struct file *file, | |||
348 | ClearPageUptodate(page); | 349 | ClearPageUptodate(page); |
349 | goto out; | 350 | goto out; |
350 | } | 351 | } |
352 | SetPageUptodate(page); | ||
351 | } | 353 | } |
352 | SetPageUptodate(page); | ||
353 | } | 354 | } |
354 | } | 355 | } |
355 | /* If creating a page or more of holes, zero them out via truncate. | 356 | /* If creating a page or more of holes, zero them out via truncate. |
@@ -499,6 +500,13 @@ static int ecryptfs_write_end(struct file *file, | |||
499 | } | 500 | } |
500 | goto out; | 501 | goto out; |
501 | } | 502 | } |
503 | if (!PageUptodate(page)) { | ||
504 | if (copied < PAGE_CACHE_SIZE) { | ||
505 | rc = 0; | ||
506 | goto out; | ||
507 | } | ||
508 | SetPageUptodate(page); | ||
509 | } | ||
502 | /* Fills in zeros if 'to' goes beyond inode size */ | 510 | /* Fills in zeros if 'to' goes beyond inode size */ |
503 | rc = fill_zeros_to_end_of_page(page, to); | 511 | rc = fill_zeros_to_end_of_page(page, to); |
504 | if (rc) { | 512 | if (rc) { |