Lines Matching full:v

53 	struct dm_verity *v;  member
87 static sector_t verity_map_sector(struct dm_verity *v, sector_t bi_sector) in verity_map_sector() argument
89 return v->data_start + dm_target_offset(v->ti, bi_sector); in verity_map_sector()
98 static sector_t verity_position_at_level(struct dm_verity *v, sector_t block, in verity_position_at_level() argument
101 return block >> (level * v->hash_per_block_bits); in verity_position_at_level()
104 static int verity_hash_update(struct dm_verity *v, struct ahash_request *req, in verity_hash_update() argument
137 static int verity_hash_init(struct dm_verity *v, struct ahash_request *req, in verity_hash_init() argument
142 ahash_request_set_tfm(req, v->tfm); in verity_hash_init()
156 if (likely(v->salt_size && (v->version >= 1))) in verity_hash_init()
157 r = verity_hash_update(v, req, v->salt, v->salt_size, wait); in verity_hash_init()
162 static int verity_hash_final(struct dm_verity *v, struct ahash_request *req, in verity_hash_final() argument
167 if (unlikely(v->salt_size && (!v->version))) { in verity_hash_final()
168 r = verity_hash_update(v, req, v->salt, v->salt_size, wait); in verity_hash_final()
182 int verity_hash(struct dm_verity *v, struct ahash_request *req, in verity_hash() argument
188 r = verity_hash_init(v, req, &wait, may_sleep); in verity_hash()
192 r = verity_hash_update(v, req, data, len, &wait); in verity_hash()
196 r = verity_hash_final(v, req, digest, &wait); in verity_hash()
202 static void verity_hash_at_level(struct dm_verity *v, sector_t block, int level, in verity_hash_at_level() argument
205 sector_t position = verity_position_at_level(v, block, level); in verity_hash_at_level()
208 *hash_block = v->hash_level_block[level] + (position >> v->hash_per_block_bits); in verity_hash_at_level()
213 idx = position & ((1 << v->hash_per_block_bits) - 1); in verity_hash_at_level()
214 if (!v->version) in verity_hash_at_level()
215 *offset = idx * v->digest_size; in verity_hash_at_level()
217 *offset = idx << (v->hash_dev_block_bits - v->hash_per_block_bits); in verity_hash_at_level()
223 static int verity_handle_err(struct dm_verity *v, enum verity_block_type type, in verity_handle_err() argument
229 struct mapped_device *md = dm_table_get_md(v->ti->table); in verity_handle_err()
232 v->hash_failed = true; in verity_handle_err()
234 if (v->corrupted_errs >= DM_VERITY_MAX_CORRUPTED_ERRS) in verity_handle_err()
237 v->corrupted_errs++; in verity_handle_err()
250 DMERR_LIMIT("%s: %s block %llu is corrupted", v->data_dev->name, in verity_handle_err()
253 if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS) { in verity_handle_err()
254 DMERR("%s: reached maximum errors", v->data_dev->name); in verity_handle_err()
255 dm_audit_log_target(DM_MSG_PREFIX, "max-corrupted-errors", v->ti, 0); in verity_handle_err()
264 if (v->mode == DM_VERITY_MODE_LOGGING) in verity_handle_err()
267 if (v->mode == DM_VERITY_MODE_RESTART) in verity_handle_err()
270 if (v->mode == DM_VERITY_MODE_PANIC) in verity_handle_err()
280 * On successful return, verity_io_want_digest(v, io) contains the hash value
285 * against current value of verity_io_want_digest(v, io).
287 static int verity_verify_level(struct dm_verity *v, struct dm_verity_io *io, in verity_verify_level() argument
298 verity_hash_at_level(v, block, level, &hash_block, &offset); in verity_verify_level()
301 data = dm_bufio_get(v->bufio, hash_block, &buf); in verity_verify_level()
311 data = dm_bufio_read(v->bufio, hash_block, &buf); in verity_verify_level()
324 r = verity_hash(v, verity_io_hash_req(v, io), in verity_verify_level()
325 data, 1 << v->hash_dev_block_bits, in verity_verify_level()
326 verity_io_real_digest(v, io), !io->in_tasklet); in verity_verify_level()
330 if (likely(memcmp(verity_io_real_digest(v, io), want_digest, in verity_verify_level()
331 v->digest_size) == 0)) in verity_verify_level()
341 } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_METADATA, in verity_verify_level()
344 else if (verity_handle_err(v, in verity_verify_level()
349 v->ti->per_io_data_size); in verity_verify_level()
358 memcpy(want_digest, data, v->digest_size); in verity_verify_level()
370 int verity_hash_for_block(struct dm_verity *v, struct dm_verity_io *io, in verity_hash_for_block() argument
375 if (likely(v->levels)) { in verity_hash_for_block()
383 r = verity_verify_level(v, io, block, 0, true, digest); in verity_hash_for_block()
388 memcpy(digest, v->root_digest, v->digest_size); in verity_hash_for_block()
390 for (i = v->levels - 1; i >= 0; i--) { in verity_hash_for_block()
391 r = verity_verify_level(v, io, block, i, false, digest); in verity_hash_for_block()
396 if (!r && v->zero_digest) in verity_hash_for_block()
397 *is_zero = !memcmp(v->zero_digest, digest, v->digest_size); in verity_hash_for_block()
407 static int verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io, in verity_for_io_block() argument
410 unsigned int todo = 1 << v->data_dev_block_bits; in verity_for_io_block()
411 struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); in verity_for_io_block()
413 struct ahash_request *req = verity_io_hash_req(v, io); in verity_for_io_block()
448 * Calls function process for 1 << v->data_dev_block_bits bytes in the bio_vec
451 int verity_for_bv_block(struct dm_verity *v, struct dm_verity_io *io, in verity_for_bv_block() argument
453 int (*process)(struct dm_verity *v, in verity_for_bv_block() argument
457 unsigned int todo = 1 << v->data_dev_block_bits; in verity_for_bv_block()
458 struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); in verity_for_bv_block()
472 r = process(v, io, page, len); in verity_for_bv_block()
485 static int verity_recheck_copy(struct dm_verity *v, struct dm_verity_io *io, in verity_recheck_copy() argument
494 static noinline int verity_recheck(struct dm_verity *v, struct dm_verity_io *io, in verity_recheck() argument
503 page = mempool_alloc(&v->recheck_pool, GFP_NOIO); in verity_recheck()
510 io_req.client = v->io; in verity_recheck()
511 io_loc.bdev = v->data_dev->bdev; in verity_recheck()
512 io_loc.sector = cur_block << (v->data_dev_block_bits - SECTOR_SHIFT); in verity_recheck()
513 io_loc.count = 1 << (v->data_dev_block_bits - SECTOR_SHIFT); in verity_recheck()
518 r = verity_hash(v, verity_io_hash_req(v, io), buffer, in verity_recheck()
519 1 << v->data_dev_block_bits, in verity_recheck()
520 verity_io_real_digest(v, io), true); in verity_recheck()
524 if (memcmp(verity_io_real_digest(v, io), in verity_recheck()
525 verity_io_want_digest(v, io), v->digest_size)) { in verity_recheck()
531 r = verity_for_bv_block(v, io, &start, verity_recheck_copy); in verity_recheck()
537 mempool_free(page, &v->recheck_pool); in verity_recheck()
542 static int verity_bv_zero(struct dm_verity *v, struct dm_verity_io *io, in verity_bv_zero() argument
552 static inline void verity_bv_skip_block(struct dm_verity *v, in verity_bv_skip_block() argument
556 struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); in verity_bv_skip_block()
558 bio_advance_iter(bio, iter, 1 << v->data_dev_block_bits); in verity_bv_skip_block()
567 struct dm_verity *v = io->v; in verity_verify_io() local
572 struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); in verity_verify_io()
588 struct ahash_request *req = verity_io_hash_req(v, io); in verity_verify_io()
590 if (v->validated_blocks && bio->bi_status == BLK_STS_OK && in verity_verify_io()
591 likely(test_bit(cur_block, v->validated_blocks))) { in verity_verify_io()
592 verity_bv_skip_block(v, io, iter); in verity_verify_io()
596 r = verity_hash_for_block(v, io, cur_block, in verity_verify_io()
597 verity_io_want_digest(v, io), in verity_verify_io()
607 r = verity_for_bv_block(v, io, iter, in verity_verify_io()
615 r = verity_hash_init(v, req, &wait, !io->in_tasklet); in verity_verify_io()
620 r = verity_for_io_block(v, io, iter, &wait); in verity_verify_io()
624 r = verity_hash_final(v, req, verity_io_real_digest(v, io), in verity_verify_io()
629 if (likely(memcmp(verity_io_real_digest(v, io), in verity_verify_io()
630 verity_io_want_digest(v, io), v->digest_size) == 0)) { in verity_verify_io()
631 if (v->validated_blocks) in verity_verify_io()
632 set_bit(cur_block, v->validated_blocks); in verity_verify_io()
641 } else if (verity_recheck(v, io, start, cur_block) == 0) { in verity_verify_io()
642 if (v->validated_blocks) in verity_verify_io()
643 set_bit(cur_block, v->validated_blocks); in verity_verify_io()
646 } else if (verity_fec_decode(v, io, DM_VERITY_BLOCK_TYPE_DATA, in verity_verify_io()
657 if (verity_handle_err(v, DM_VERITY_BLOCK_TYPE_DATA, in verity_verify_io()
683 struct dm_verity *v = io->v; in verity_finish_io() local
684 struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size); in verity_finish_io()
709 (!verity_fec_is_enabled(io->v) || in verity_end_io()
717 queue_work(io->v->verify_wq, &io->work); in verity_end_io()
729 struct dm_verity *v = pw->v; in verity_prefetch_io() local
732 for (i = v->levels - 2; i >= 0; i--) { in verity_prefetch_io()
736 verity_hash_at_level(v, pw->block, i, &hash_block_start, NULL); in verity_prefetch_io()
737 verity_hash_at_level(v, pw->block + pw->n_blocks - 1, i, &hash_block_end, NULL); in verity_prefetch_io()
742 cluster >>= v->data_dev_block_bits; in verity_prefetch_io()
751 if (unlikely(hash_block_end >= v->hash_blocks)) in verity_prefetch_io()
752 hash_block_end = v->hash_blocks - 1; in verity_prefetch_io()
755 dm_bufio_prefetch(v->bufio, hash_block_start, in verity_prefetch_io()
762 static void verity_submit_prefetch(struct dm_verity *v, struct dm_verity_io *io) in verity_submit_prefetch() argument
768 if (v->validated_blocks) { in verity_submit_prefetch()
769 while (n_blocks && test_bit(block, v->validated_blocks)) { in verity_submit_prefetch()
774 v->validated_blocks)) in verity_submit_prefetch()
787 pw->v = v; in verity_submit_prefetch()
790 queue_work(v->verify_wq, &pw->work); in verity_submit_prefetch()
799 struct dm_verity *v = ti->private; in verity_map() local
802 bio_set_dev(bio, v->data_dev->bdev); in verity_map()
803 bio->bi_iter.bi_sector = verity_map_sector(v, bio->bi_iter.bi_sector); in verity_map()
806 ((1 << (v->data_dev_block_bits - SECTOR_SHIFT)) - 1)) { in verity_map()
812 (v->data_dev_block_bits - SECTOR_SHIFT) > v->data_blocks) { in verity_map()
821 io->v = v; in verity_map()
823 io->block = bio->bi_iter.bi_sector >> (v->data_dev_block_bits - SECTOR_SHIFT); in verity_map()
824 io->n_blocks = bio->bi_iter.bi_size >> v->data_dev_block_bits; in verity_map()
832 verity_submit_prefetch(v, io); in verity_map()
840 * Status: V (valid) or C (corruption found)
845 struct dm_verity *v = ti->private; in verity_status() local
852 DMEMIT("%c", v->hash_failed ? 'C' : 'V'); in verity_status()
856 v->version, in verity_status()
857 v->data_dev->name, in verity_status()
858 v->hash_dev->name, in verity_status()
859 1 << v->data_dev_block_bits, in verity_status()
860 1 << v->hash_dev_block_bits, in verity_status()
861 (unsigned long long)v->data_blocks, in verity_status()
862 (unsigned long long)v->hash_start, in verity_status()
863 v->alg_name in verity_status()
865 for (x = 0; x < v->digest_size; x++) in verity_status()
866 DMEMIT("%02x", v->root_digest[x]); in verity_status()
868 if (!v->salt_size) in verity_status()
871 for (x = 0; x < v->salt_size; x++) in verity_status()
872 DMEMIT("%02x", v->salt[x]); in verity_status()
873 if (v->mode != DM_VERITY_MODE_EIO) in verity_status()
875 if (verity_fec_is_enabled(v)) in verity_status()
877 if (v->zero_digest) in verity_status()
879 if (v->validated_blocks) in verity_status()
881 if (v->use_tasklet) in verity_status()
883 if (v->signature_key_desc) in verity_status()
888 if (v->mode != DM_VERITY_MODE_EIO) { in verity_status()
890 switch (v->mode) { in verity_status()
904 if (v->zero_digest) in verity_status()
906 if (v->validated_blocks) in verity_status()
908 if (v->use_tasklet) in verity_status()
910 sz = verity_fec_status_table(v, sz, result, maxlen); in verity_status()
911 if (v->signature_key_desc) in verity_status()
913 " %s", v->signature_key_desc); in verity_status()
918 DMEMIT(",hash_failed=%c", v->hash_failed ? 'C' : 'V'); in verity_status()
919 DMEMIT(",verity_version=%u", v->version); in verity_status()
920 DMEMIT(",data_device_name=%s", v->data_dev->name); in verity_status()
921 DMEMIT(",hash_device_name=%s", v->hash_dev->name); in verity_status()
922 DMEMIT(",verity_algorithm=%s", v->alg_name); in verity_status()
925 for (x = 0; x < v->digest_size; x++) in verity_status()
926 DMEMIT("%02x", v->root_digest[x]); in verity_status()
929 if (!v->salt_size) in verity_status()
932 for (x = 0; x < v->salt_size; x++) in verity_status()
933 DMEMIT("%02x", v->salt[x]); in verity_status()
935 DMEMIT(",ignore_zero_blocks=%c", v->zero_digest ? 'y' : 'n'); in verity_status()
936 DMEMIT(",check_at_most_once=%c", v->validated_blocks ? 'y' : 'n'); in verity_status()
937 if (v->signature_key_desc) in verity_status()
938 DMEMIT(",root_hash_sig_key_desc=%s", v->signature_key_desc); in verity_status()
940 if (v->mode != DM_VERITY_MODE_EIO) { in verity_status()
942 switch (v->mode) { in verity_status()
963 struct dm_verity *v = ti->private; in verity_prepare_ioctl() local
965 *bdev = v->data_dev->bdev; in verity_prepare_ioctl()
967 if (v->data_start || ti->len != bdev_nr_sectors(v->data_dev->bdev)) in verity_prepare_ioctl()
975 struct dm_verity *v = ti->private; in verity_iterate_devices() local
977 return fn(ti, v->data_dev, v->data_start, ti->len, data); in verity_iterate_devices()
982 struct dm_verity *v = ti->private; in verity_io_hints() local
984 if (limits->logical_block_size < 1 << v->data_dev_block_bits) in verity_io_hints()
985 limits->logical_block_size = 1 << v->data_dev_block_bits; in verity_io_hints()
987 if (limits->physical_block_size < 1 << v->data_dev_block_bits) in verity_io_hints()
988 limits->physical_block_size = 1 << v->data_dev_block_bits; in verity_io_hints()
995 struct dm_verity *v = ti->private; in verity_dtr() local
997 if (v->verify_wq) in verity_dtr()
998 destroy_workqueue(v->verify_wq); in verity_dtr()
1000 mempool_exit(&v->recheck_pool); in verity_dtr()
1001 if (v->io) in verity_dtr()
1002 dm_io_client_destroy(v->io); in verity_dtr()
1004 if (v->bufio) in verity_dtr()
1005 dm_bufio_client_destroy(v->bufio); in verity_dtr()
1007 kvfree(v->validated_blocks); in verity_dtr()
1008 kfree(v->salt); in verity_dtr()
1009 kfree(v->root_digest); in verity_dtr()
1010 kfree(v->zero_digest); in verity_dtr()
1012 if (v->tfm) in verity_dtr()
1013 crypto_free_ahash(v->tfm); in verity_dtr()
1015 kfree(v->alg_name); in verity_dtr()
1017 if (v->hash_dev) in verity_dtr()
1018 dm_put_device(ti, v->hash_dev); in verity_dtr()
1020 if (v->data_dev) in verity_dtr()
1021 dm_put_device(ti, v->data_dev); in verity_dtr()
1023 verity_fec_dtr(v); in verity_dtr()
1025 kfree(v->signature_key_desc); in verity_dtr()
1027 if (v->use_tasklet) in verity_dtr()
1030 kfree(v); in verity_dtr()
1035 static int verity_alloc_most_once(struct dm_verity *v) in verity_alloc_most_once() argument
1037 struct dm_target *ti = v->ti; in verity_alloc_most_once()
1040 if (v->data_blocks > INT_MAX) { in verity_alloc_most_once()
1045 v->validated_blocks = kvcalloc(BITS_TO_LONGS(v->data_blocks), in verity_alloc_most_once()
1048 if (!v->validated_blocks) { in verity_alloc_most_once()
1056 static int verity_alloc_zero_digest(struct dm_verity *v) in verity_alloc_zero_digest() argument
1062 v->zero_digest = kmalloc(v->digest_size, GFP_KERNEL); in verity_alloc_zero_digest()
1064 if (!v->zero_digest) in verity_alloc_zero_digest()
1067 req = kmalloc(v->ahash_reqsize, GFP_KERNEL); in verity_alloc_zero_digest()
1072 zero_data = kzalloc(1 << v->data_dev_block_bits, GFP_KERNEL); in verity_alloc_zero_digest()
1077 r = verity_hash(v, req, zero_data, 1 << v->data_dev_block_bits, in verity_alloc_zero_digest()
1078 v->zero_digest, true); in verity_alloc_zero_digest()
1094 static int verity_parse_verity_mode(struct dm_verity *v, const char *arg_name) in verity_parse_verity_mode() argument
1096 if (v->mode) in verity_parse_verity_mode()
1100 v->mode = DM_VERITY_MODE_LOGGING; in verity_parse_verity_mode()
1102 v->mode = DM_VERITY_MODE_RESTART; in verity_parse_verity_mode()
1104 v->mode = DM_VERITY_MODE_PANIC; in verity_parse_verity_mode()
1109 static int verity_parse_opt_args(struct dm_arg_set *as, struct dm_verity *v, in verity_parse_opt_args() argument
1115 struct dm_target *ti = v->ti; in verity_parse_opt_args()
1136 r = verity_parse_verity_mode(v, arg_name); in verity_parse_opt_args()
1146 r = verity_alloc_zero_digest(v); in verity_parse_opt_args()
1156 r = verity_alloc_most_once(v); in verity_parse_opt_args()
1162 v->use_tasklet = true; in verity_parse_opt_args()
1169 r = verity_fec_parse_opt_args(as, v, &argc, arg_name); in verity_parse_opt_args()
1177 r = verity_verify_sig_parse_opt_args(as, v, in verity_parse_opt_args()
1218 struct dm_verity *v; in verity_ctr() local
1229 v = kzalloc(sizeof(struct dm_verity), GFP_KERNEL); in verity_ctr()
1230 if (!v) { in verity_ctr()
1234 ti->private = v; in verity_ctr()
1235 v->ti = ti; in verity_ctr()
1237 r = verity_fec_ctr_alloc(v); in verity_ctr()
1257 r = verity_parse_opt_args(&as, v, &verify_args, true); in verity_ctr()
1268 v->version = num; in verity_ctr()
1270 r = dm_get_device(ti, argv[1], BLK_OPEN_READ, &v->data_dev); in verity_ctr()
1276 r = dm_get_device(ti, argv[2], BLK_OPEN_READ, &v->hash_dev); in verity_ctr()
1284 num < bdev_logical_block_size(v->data_dev->bdev) || in verity_ctr()
1290 v->data_dev_block_bits = __ffs(num); in verity_ctr()
1294 num < bdev_logical_block_size(v->hash_dev->bdev) || in verity_ctr()
1300 v->hash_dev_block_bits = __ffs(num); in verity_ctr()
1303 (sector_t)(num_ll << (v->data_dev_block_bits - SECTOR_SHIFT)) in verity_ctr()
1304 >> (v->data_dev_block_bits - SECTOR_SHIFT) != num_ll) { in verity_ctr()
1309 v->data_blocks = num_ll; in verity_ctr()
1311 if (ti->len > (v->data_blocks << (v->data_dev_block_bits - SECTOR_SHIFT))) { in verity_ctr()
1318 (sector_t)(num_ll << (v->hash_dev_block_bits - SECTOR_SHIFT)) in verity_ctr()
1319 >> (v->hash_dev_block_bits - SECTOR_SHIFT) != num_ll) { in verity_ctr()
1324 v->hash_start = num_ll; in verity_ctr()
1326 v->alg_name = kstrdup(argv[7], GFP_KERNEL); in verity_ctr()
1327 if (!v->alg_name) { in verity_ctr()
1333 v->tfm = crypto_alloc_ahash(v->alg_name, 0, in verity_ctr()
1334 v->use_tasklet ? CRYPTO_ALG_ASYNC : 0); in verity_ctr()
1335 if (IS_ERR(v->tfm)) { in verity_ctr()
1337 r = PTR_ERR(v->tfm); in verity_ctr()
1338 v->tfm = NULL; in verity_ctr()
1347 DMINFO("%s using implementation \"%s\"", v->alg_name, in verity_ctr()
1348 crypto_hash_alg_common(v->tfm)->base.cra_driver_name); in verity_ctr()
1350 v->digest_size = crypto_ahash_digestsize(v->tfm); in verity_ctr()
1351 if ((1 << v->hash_dev_block_bits) < v->digest_size * 2) { in verity_ctr()
1356 v->ahash_reqsize = sizeof(struct ahash_request) + in verity_ctr()
1357 crypto_ahash_reqsize(v->tfm); in verity_ctr()
1359 v->root_digest = kmalloc(v->digest_size, GFP_KERNEL); in verity_ctr()
1360 if (!v->root_digest) { in verity_ctr()
1365 if (strlen(argv[8]) != v->digest_size * 2 || in verity_ctr()
1366 hex2bin(v->root_digest, argv[8], v->digest_size)) { in verity_ctr()
1374 v->salt_size = strlen(argv[9]) / 2; in verity_ctr()
1375 v->salt = kmalloc(v->salt_size, GFP_KERNEL); in verity_ctr()
1376 if (!v->salt) { in verity_ctr()
1381 if (strlen(argv[9]) != v->salt_size * 2 || in verity_ctr()
1382 hex2bin(v->salt, argv[9], v->salt_size)) { in verity_ctr()
1396 r = verity_parse_opt_args(&as, v, &verify_args, false); in verity_ctr()
1410 v->hash_per_block_bits = in verity_ctr()
1411 __fls((1 << v->hash_dev_block_bits) / v->digest_size); in verity_ctr()
1413 v->levels = 0; in verity_ctr()
1414 if (v->data_blocks) in verity_ctr()
1415 while (v->hash_per_block_bits * v->levels < 64 && in verity_ctr()
1416 (unsigned long long)(v->data_blocks - 1) >> in verity_ctr()
1417 (v->hash_per_block_bits * v->levels)) in verity_ctr()
1418 v->levels++; in verity_ctr()
1420 if (v->levels > DM_VERITY_MAX_LEVELS) { in verity_ctr()
1426 hash_position = v->hash_start; in verity_ctr()
1427 for (i = v->levels - 1; i >= 0; i--) { in verity_ctr()
1430 v->hash_level_block[i] = hash_position; in verity_ctr()
1431 s = (v->data_blocks + ((sector_t)1 << ((i + 1) * v->hash_per_block_bits)) - 1) in verity_ctr()
1432 >> ((i + 1) * v->hash_per_block_bits); in verity_ctr()
1440 v->hash_blocks = hash_position; in verity_ctr()
1442 r = mempool_init_page_pool(&v->recheck_pool, 1, 0); in verity_ctr()
1448 v->io = dm_io_client_create(); in verity_ctr()
1449 if (IS_ERR(v->io)) { in verity_ctr()
1450 r = PTR_ERR(v->io); in verity_ctr()
1451 v->io = NULL; in verity_ctr()
1456 v->bufio = dm_bufio_client_create(v->hash_dev->bdev, in verity_ctr()
1457 1 << v->hash_dev_block_bits, 1, sizeof(struct buffer_aux), in verity_ctr()
1459 v->use_tasklet ? DM_BUFIO_CLIENT_NO_SLEEP : 0); in verity_ctr()
1460 if (IS_ERR(v->bufio)) { in verity_ctr()
1462 r = PTR_ERR(v->bufio); in verity_ctr()
1463 v->bufio = NULL; in verity_ctr()
1467 if (dm_bufio_get_device_size(v->bufio) < v->hash_blocks) { in verity_ctr()
1482 v->verify_wq = alloc_workqueue("kverityd", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0); in verity_ctr()
1483 if (!v->verify_wq) { in verity_ctr()
1490 v->ahash_reqsize + v->digest_size * 2; in verity_ctr()
1492 r = verity_fec_ctr(v); in verity_ctr()
1522 struct dm_verity *v = ti->private; in dm_verity_get_mode() local
1527 return v->mode; in dm_verity_get_mode()
1538 struct dm_verity *v = ti->private; in dm_verity_get_root_digest() local
1543 *root_digest = kmemdup(v->root_digest, v->digest_size, GFP_KERNEL); in dm_verity_get_root_digest()
1547 *digest_size = v->digest_size; in dm_verity_get_root_digest()