aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio-integrity.c
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2012-10-12 16:18:27 -0400
committerKent Overstreet <koverstreet@google.com>2013-03-23 17:15:26 -0400
commit6fda981cafbf908acd11e1e636fec50e99d56a47 (patch)
treebe6c8b95551a6081745ab937241dc4a3ef348676 /fs/bio-integrity.c
parentdf2cb6daa4cbc34406bc4b1ac9b9335df1083a72 (diff)
block: Fix a buffer overrun in bio_integrity_split()
bio_integrity_split() seemed to be confusing pointers and arrays - bip_vec in bio_integrity_payload was an array appended to the end of the payload, so the bio_vecs in struct bio_pair should have come after the bio_integrity_payload they're for. Fix it by making bip_vec a pointer to the inline vecs - a later patch is going to make more use of this pointer. Signed-off-by: Kent Overstreet <koverstreet@google.com> CC: Jens Axboe <axboe@kernel.dk> CC: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'fs/bio-integrity.c')
-rw-r--r--fs/bio-integrity.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index a3f28f331b2b..94fa1c562c0e 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -112,6 +112,7 @@ struct bio_integrity_payload *bio_integrity_alloc(struct bio *bio,
112 112
113 bip->bip_slab = idx; 113 bip->bip_slab = idx;
114 bip->bip_bio = bio; 114 bip->bip_bio = bio;
115 bip->bip_vec = bip->bip_inline_vecs;
115 bio->bi_integrity = bip; 116 bio->bi_integrity = bip;
116 117
117 return bip; 118 return bip;
@@ -697,8 +698,8 @@ void bio_integrity_split(struct bio *bio, struct bio_pair *bp, int sectors)
697 bp->iv1 = bip->bip_vec[0]; 698 bp->iv1 = bip->bip_vec[0];
698 bp->iv2 = bip->bip_vec[0]; 699 bp->iv2 = bip->bip_vec[0];
699 700
700 bp->bip1.bip_vec[0] = bp->iv1; 701 bp->bip1.bip_vec = &bp->iv1;
701 bp->bip2.bip_vec[0] = bp->iv2; 702 bp->bip2.bip_vec = &bp->iv2;
702 703
703 bp->iv1.bv_len = sectors * bi->tuple_size; 704 bp->iv1.bv_len = sectors * bi->tuple_size;
704 bp->iv2.bv_offset += sectors * bi->tuple_size; 705 bp->iv2.bv_offset += sectors * bi->tuple_size;