[PATCH] block: pass correct prot_buf pointer to integrity metadata processing function

From: Sam Bradshaw
Date: Wed Jan 14 2015 - 14:45:05 EST


The prot_buf pointer passed to the generate/verify functions is
incorrect for the second and subsequent range, making it impossible
to verify the guard tag. The patch correctly increments the prot_buf
pointer by the tuple size for each pass.

Signed-off-by: Sam Bradshaw <sbradshaw@xxxxxxxxxx>
---
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 5cbd5d9..c7cbf60 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -226,13 +226,13 @@ static int bio_integrity_process(struct bio *bio,
iter.disk_name = bio->bi_bdev->bd_disk->disk_name;
iter.interval = bi->interval;
iter.seed = bip_get_seed(bip);
- iter.prot_buf = prot_buf;

bio_for_each_segment(bv, bio, bviter) {
void *kaddr = kmap_atomic(bv.bv_page);

iter.data_buf = kaddr + bv.bv_offset;
iter.data_size = bv.bv_len;
+ iter.prot_buf = prot_buf;

ret = proc_fn(&iter);
if (ret) {
@@ -241,6 +241,7 @@ static int bio_integrity_process(struct bio *bio,
}

kunmap_atomic(kaddr);
+ prot_buf += bi->tuple_size;
}
return ret;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/