Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: drivers/md/dm-bht.c

Issue 6246094: CHROMIUM: verity: add BUG in check_block for consistency with verify_path (Closed) Base URL: http://git.chromium.org/git/kernel.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 The Chromium OS Authors <chromium-os-dev@chromium.org> 2 * Copyright (C) 2010 The Chromium OS Authors <chromium-os-dev@chromium.org>
3 * 3 *
4 * Device-Mapper block hash tree interface. 4 * Device-Mapper block hash tree interface.
5 * See Documentation/device-mapper/dm-bht.txt for details. 5 * See Documentation/device-mapper/dm-bht.txt for details.
6 * 6 *
7 * This file is released under the GPL. 7 * This file is released under the GPL.
8 */ 8 */
9 9
10 #include <asm/atomic.h> 10 #include <asm/atomic.h>
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 /* The leaves contain the block hashes */ 608 /* The leaves contain the block hashes */
609 depth = bht->depth - 1; 609 depth = bht->depth - 1;
610 610
611 /* Index into the bottom level. Each entry in this level contains 611 /* Index into the bottom level. Each entry in this level contains
612 * nodes whose hashes are the direct hashes of one block of data on 612 * nodes whose hashes are the direct hashes of one block of data on
613 * disk. 613 * disk.
614 */ 614 */
615 index = block_index >> bht->node_count_shift; 615 index = block_index >> bht->node_count_shift;
616 entry = &bht->levels[depth].entries[index]; 616 entry = &bht->levels[depth].entries[index];
617 617
618 » *entry_state = atomic_read(&entry->state); 618 » /* This call is only safe if all nodes along the path
619 » if (*entry_state <= DM_BHT_ENTRY_ERROR) { 619 » * are already populated (i.e. READY) via dm_bht_populate.
620 » » DMCRIT("leaf entry for block %u is invalid", 620 » */
621 » » block_index); 621 » BUG_ON(atomic_read(&entry->state) < DM_BHT_ENTRY_READY);
622 » » return *entry_state;
623 » }
624 » if (*entry_state <= DM_BHT_ENTRY_PENDING) {
625 » » DMERR("leaf data not yet loaded for block %u",
626 » » block_index);
627 » » return 1;
628 » }
629 622
630 /* Index into the entry data */ 623 /* Index into the entry data */
631 index = (block_index % bht->node_count) * bht->digest_size; 624 index = (block_index % bht->node_count) * bht->digest_size;
632 if (memcmp(&entry->nodes[index], digest, bht->digest_size)) { 625 if (memcmp(&entry->nodes[index], digest, bht->digest_size)) {
633 DMCRIT("digest mismatch for block %u", block_index); 626 DMCRIT("digest mismatch for block %u", block_index);
634 dm_bht_log_mismatch(bht, &entry->nodes[index], digest); 627 dm_bht_log_mismatch(bht, &entry->nodes[index], digest);
635 return DM_BHT_ENTRY_ERROR_MISMATCH; 628 return DM_BHT_ENTRY_ERROR_MISMATCH;
636 } 629 }
637 /* TODO(wad) update bht->block_bitmap here or in the caller */ 630 /* TODO(wad) update bht->block_bitmap here or in the caller */
638 return 0; 631 return 0;
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 DMERR("no root digest exists to export"); 1287 DMERR("no root digest exists to export");
1295 if (available > 0) 1288 if (available > 0)
1296 *hexdigest = 0; 1289 *hexdigest = 0;
1297 return -1; 1290 return -1;
1298 } 1291 }
1299 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size); 1292 dm_bht_bin_to_hex(bht->root_digest, hexdigest, bht->digest_size);
1300 return 0; 1293 return 0;
1301 } 1294 }
1302 EXPORT_SYMBOL(dm_bht_root_hexdigest); 1295 EXPORT_SYMBOL(dm_bht_root_hexdigest);
1303 1296
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698