All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: pass correct prot_buf pointer to integrity metadata processing function
@ 2015-01-14 19:47 Sam Bradshaw
  2015-01-14 20:22 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Sam Bradshaw @ 2015-01-14 19:47 UTC (permalink / raw)
  To: martin.petersen, axboe, linux-kernel

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@micron.com>
---
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;
 }

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] block: pass correct prot_buf pointer to integrity metadata processing function
  2015-01-14 19:47 [PATCH] block: pass correct prot_buf pointer to integrity metadata processing function Sam Bradshaw
@ 2015-01-14 20:22 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2015-01-14 20:22 UTC (permalink / raw)
  To: Sam Bradshaw; +Cc: martin.petersen, axboe, linux-kernel

>>>>> "Sam" == Sam Bradshaw <sbradshaw@micron.com> writes:

Hey Sam,

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

prot_buf is just a temporary variable used to get the kernel address of
the buffer pointer. We only care about iter.prot_buf and that gets
incremented by the generate or verify functions.

Are your data buffers page aligned? Things are going to break if they
aren't...

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-14 20:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-14 19:47 [PATCH] block: pass correct prot_buf pointer to integrity metadata processing function Sam Bradshaw
2015-01-14 20:22 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.