aboutsummaryrefslogtreecommitdiffstats
path: root/fs/verity/open.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-12-31 11:55:45 -0600
committerEric Biggers <ebiggers@google.com>2020-01-14 13:28:05 -0800
commit439bea104c3d212def0216aa8c0820872266c5b3 (patch)
tree1de5689485baeaac6b66822c57a519021a203469 /fs/verity/open.c
parentfs-verity: implement readahead of Merkle tree pages (diff)
downloadlinux-dev-439bea104c3d212def0216aa8c0820872266c5b3.tar.xz
linux-dev-439bea104c3d212def0216aa8c0820872266c5b3.zip
fs-verity: use mempool for hash requests
When initializing an fs-verity hash algorithm, also initialize a mempool that contains a single preallocated hash request object. Then replace the direct calls to ahash_request_alloc() and ahash_request_free() with allocating and freeing from this mempool. This eliminates the possibility of the allocation failing, which is desirable for the I/O path. This doesn't cause deadlocks because there's no case where multiple hash requests are needed at a time to make forward progress. Link: https://lore.kernel.org/r/20191231175545.20709-1-ebiggers@kernel.org Reviewed-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'fs/verity/open.c')
-rw-r--r--fs/verity/open.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/verity/open.c b/fs/verity/open.c
index e9cdf7d00ed2..c5fe6948e262 100644
--- a/fs/verity/open.c
+++ b/fs/verity/open.c
@@ -31,7 +31,7 @@ int fsverity_init_merkle_tree_params(struct merkle_tree_params *params,
unsigned int log_blocksize,
const u8 *salt, size_t salt_size)
{
- const struct fsverity_hash_alg *hash_alg;
+ struct fsverity_hash_alg *hash_alg;
int err;
u64 blocks;
u64 offset;
@@ -127,7 +127,7 @@ out_err:
* Compute the file measurement by hashing the fsverity_descriptor excluding the
* signature and with the sig_size field set to 0.
*/
-static int compute_file_measurement(const struct fsverity_hash_alg *hash_alg,
+static int compute_file_measurement(struct fsverity_hash_alg *hash_alg,
struct fsverity_descriptor *desc,
u8 *measurement)
{