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

Unified Diff: drivers/md/dm-bht.c

Issue 6659004: CHROMIUM: verity: remove short-circuiting of verify_path (Closed) Base URL: http://git.chromium.org/git/kernel.git@master
Patch Set: Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: drivers/md/dm-bht.c
diff --git a/drivers/md/dm-bht.c b/drivers/md/dm-bht.c
index c9d1fcac222b5c7994ab1135c67e77a060754f66..ab32ce299ebde9dbd35990f239b21face5b7ee8a 100644
--- a/drivers/md/dm-bht.c
+++ b/drivers/md/dm-bht.c
@@ -587,7 +587,7 @@ static int dm_bht_update_hash(struct dm_bht *bht, u8 *known, u8 *computed)
/* Check the disk block against the leaf hash. */
static int dm_bht_check_block(struct dm_bht *bht, unsigned int block_index,
- const void *block, int *entry_state)
+ const void *block)
{
unsigned int depth = bht->depth;
struct dm_bht_entry *parent = dm_bht_get_entry(bht, depth - 1,
@@ -599,8 +599,7 @@ static int dm_bht_check_block(struct dm_bht *bht, unsigned int block_index,
/* This call is only safe if all nodes along the path
* are already populated (i.e. READY) via dm_bht_populate.
*/
- *entry_state = atomic_read(&parent->state);
- BUG_ON(*entry_state < DM_BHT_ENTRY_READY);
+ BUG_ON(atomic_read(&parent->state) < DM_BHT_ENTRY_READY);
node = dm_bht_get_node(bht, parent, depth, block_index);
if (dm_bht_compute_hash(bht, hash_desc, virt_to_page(block), digest) ||
@@ -1062,7 +1061,6 @@ int dm_bht_verify_block(struct dm_bht *bht, unsigned int block_index,
const void *block)
{
int unverified = 0;
- int entry_state = 0;
/* Make sure that the root has been verified */
if (atomic_read(&bht->root_state) != DM_BHT_ENTRY_VERIFIED) {
@@ -1074,22 +1072,13 @@ int dm_bht_verify_block(struct dm_bht *bht, unsigned int block_index,
}
/* Now check that the digest supplied matches the leaf hash */
- unverified = dm_bht_check_block(bht, block_index, block, &entry_state);
+ unverified = dm_bht_check_block(bht, block_index, block);
if (unverified) {
DMERR_LIMIT("Block check failed for %u: %d", block_index,
unverified);
return unverified;
}
- /* If the entry which contains the block hash is marked verified, then
- * it means that its hash has been check with the parent. In addition,
- * since that is only possible via verify_path, it transitively means
- * it is verified to the root of the tree. If the depth is 1, then it
- * means the entry was verified during root verification.
- */
- if (entry_state == DM_BHT_ENTRY_VERIFIED || bht->depth == 1)
- return unverified;
-
/* Now check levels in between */
unverified = dm_bht_verify_path(bht, block_index);
if (unverified)
« 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