diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-07-10 14:01:03 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-07-10 14:01:03 -0400 |
commit | a7550b30ab709ffb9bbe48669adf7d8556f3698f (patch) | |
tree | 5ed986d93b2df41cad68bdfa0851604bb039d1d1 /fs/ext4/file.c | |
parent | ff0031d848a0cd7002606f9feef958de8d5edf19 (diff) |
ext4 crypto: migrate into vfs's crypto engine
This patch removes the most parts of internal crypto codes.
And then, it modifies and adds some ext4-specific crypt codes to use the generic
facility.
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/file.c')
-rw-r--r-- | fs/ext4/file.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index df44c877892a..4f615cdd22ca 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -303,10 +303,10 @@ static int ext4_file_mmap(struct file *file, struct vm_area_struct *vma) | |||
303 | struct inode *inode = file->f_mapping->host; | 303 | struct inode *inode = file->f_mapping->host; |
304 | 304 | ||
305 | if (ext4_encrypted_inode(inode)) { | 305 | if (ext4_encrypted_inode(inode)) { |
306 | int err = ext4_get_encryption_info(inode); | 306 | int err = fscrypt_get_encryption_info(inode); |
307 | if (err) | 307 | if (err) |
308 | return 0; | 308 | return 0; |
309 | if (ext4_encryption_info(inode) == NULL) | 309 | if (!fscrypt_has_encryption_key(inode)) |
310 | return -ENOKEY; | 310 | return -ENOKEY; |
311 | } | 311 | } |
312 | file_accessed(file); | 312 | file_accessed(file); |
@@ -362,16 +362,16 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
362 | } | 362 | } |
363 | } | 363 | } |
364 | if (ext4_encrypted_inode(inode)) { | 364 | if (ext4_encrypted_inode(inode)) { |
365 | ret = ext4_get_encryption_info(inode); | 365 | ret = fscrypt_get_encryption_info(inode); |
366 | if (ret) | 366 | if (ret) |
367 | return -EACCES; | 367 | return -EACCES; |
368 | if (ext4_encryption_info(inode) == NULL) | 368 | if (!fscrypt_has_encryption_key(inode)) |
369 | return -ENOKEY; | 369 | return -ENOKEY; |
370 | } | 370 | } |
371 | 371 | ||
372 | dir = dget_parent(file_dentry(filp)); | 372 | dir = dget_parent(file_dentry(filp)); |
373 | if (ext4_encrypted_inode(d_inode(dir)) && | 373 | if (ext4_encrypted_inode(d_inode(dir)) && |
374 | !ext4_is_child_context_consistent_with_parent(d_inode(dir), inode)) { | 374 | !fscrypt_has_permitted_context(d_inode(dir), inode)) { |
375 | ext4_warning(inode->i_sb, | 375 | ext4_warning(inode->i_sb, |
376 | "Inconsistent encryption contexts: %lu/%lu", | 376 | "Inconsistent encryption contexts: %lu/%lu", |
377 | (unsigned long) d_inode(dir)->i_ino, | 377 | (unsigned long) d_inode(dir)->i_ino, |