From f0988ea8e40abae99fc5ac936f40432675a4c956 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 15 Sep 2016 18:09:39 -0400 Subject: [PATCH] add patch fscrypto-rename-completion-callbacks-to-reflect-usage --- ...to-rename-completion-callbacks-to-reflect-usage | 83 ++++++++++++++++++++++ series | 1 + timestamps | 10 +-- 3 files changed, 90 insertions(+), 4 deletions(-) create mode 100644 fscrypto-rename-completion-callbacks-to-reflect-usage diff --git a/fscrypto-rename-completion-callbacks-to-reflect-usage b/fscrypto-rename-completion-callbacks-to-reflect-usage new file mode 100644 index 00000000..10c967f2 --- /dev/null +++ b/fscrypto-rename-completion-callbacks-to-reflect-usage @@ -0,0 +1,83 @@ +fscrypto: rename completion callbacks to reflect usage + +From: Eric Biggers + +fscrypt_complete() was used only for data pages, not for all +encryption/decryption. Rename it to page_crypt_complete(). + +dir_crypt_complete() was used for filename encryption/decryption for +both directory entries and symbolic links. Rename it to +fname_crypt_complete(). + +Signed-off-by: Eric Biggers +Signed-off-by: Theodore Ts'o +--- + fs/crypto/crypto.c | 10 +++++----- + fs/crypto/fname.c | 10 ++++++---- + 2 files changed, 11 insertions(+), 9 deletions(-) + +diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c +index 7c39eab..61057b7d 100644 +--- a/fs/crypto/crypto.c ++++ b/fs/crypto/crypto.c +@@ -127,11 +127,11 @@ struct fscrypt_ctx *fscrypt_get_ctx(struct inode *inode, gfp_t gfp_flags) + EXPORT_SYMBOL(fscrypt_get_ctx); + + /** +- * fscrypt_complete() - The completion callback for page encryption +- * @req: The asynchronous encryption request context +- * @res: The result of the encryption operation ++ * page_crypt_complete() - completion callback for page crypto ++ * @req: The asynchronous cipher request context ++ * @res: The result of the cipher operation + */ +-static void fscrypt_complete(struct crypto_async_request *req, int res) ++static void page_crypt_complete(struct crypto_async_request *req, int res) + { + struct fscrypt_completion_result *ecr = req->data; + +@@ -169,7 +169,7 @@ static int do_page_crypto(struct inode *inode, + + skcipher_request_set_callback( + req, CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, +- fscrypt_complete, &ecr); ++ page_crypt_complete, &ecr); + + BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index)); + memcpy(xts_tweak, &index, sizeof(index)); +diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c +index 7f3239c..db8f798 100644 +--- a/fs/crypto/fname.c ++++ b/fs/crypto/fname.c +@@ -20,9 +20,11 @@ static u32 size_round_up(size_t size, size_t blksize) + } + + /** +- * dir_crypt_complete() - ++ * fname_crypt_complete() - completion callback for filename crypto ++ * @req: The asynchronous cipher request context ++ * @res: The result of the cipher operation + */ +-static void dir_crypt_complete(struct crypto_async_request *req, int res) ++static void fname_crypt_complete(struct crypto_async_request *req, int res) + { + struct fscrypt_completion_result *ecr = req->data; + +@@ -82,7 +84,7 @@ static int fname_encrypt(struct inode *inode, + } + skcipher_request_set_callback(req, + CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, +- dir_crypt_complete, &ecr); ++ fname_crypt_complete, &ecr); + + /* Copy the input */ + memcpy(workbuf, iname->name, iname->len); +@@ -145,7 +147,7 @@ static int fname_decrypt(struct inode *inode, + } + skcipher_request_set_callback(req, + CRYPTO_TFM_REQ_MAY_BACKLOG | CRYPTO_TFM_REQ_MAY_SLEEP, +- dir_crypt_complete, &ecr); ++ fname_crypt_complete, &ecr); + + /* Initialize IV */ + memset(iv, 0, FS_CRYPTO_BLOCK_SIZE); diff --git a/series b/series index 6de93080..c688511b 100644 --- a/series +++ b/series @@ -25,6 +25,7 @@ move-more-common-code-into-journal_init_common fix-memory-leak-when-symlink-decryption-fails fscrypto-improved-validation-when-loading-inode-encryption-metadata fscrypto-remove-unnecessary-includes +fscrypto-rename-completion-callbacks-to-reflect-usage ########################################## # unstable patches diff --git a/timestamps b/timestamps index b30d17af..d3c9bbc1 100755 --- a/timestamps +++ b/timestamps @@ -61,8 +61,10 @@ touch -d @1473955127 remove-unused-definition touch -d @1473955352 move-more-common-code-into-journal_init_common touch -d @1473959593 fix-memory-leak-when-symlink-decryption-fails touch -d @1473960731 fscrypto-improved-validation-when-loading-inode-encryption-metadata -touch -d @1473960791 stable-boundary touch -d @1473972069 fscrypto-remove-unnecessary-includes -touch -d @1473972366 series -touch -d @1473972371 status -touch -d @1473972448 timestamps +touch -d @1473972661 fscrypto-rename-completion-callbacks-to-reflect-usage +touch -d @1473972721 stable-boundary +touch -d @1473974755 fscrypto-make-filename-crypto-functions-return-0-on-success +touch -d @1473974756 status +touch -d @1473977364 series +touch -d @1473977369 timestamps -- 2.11.4.GIT