summaryrefslogtreecommitdiff
path: root/block/blk-core.c
diff options
context:
space:
mode:
authorKazuhisa Ichikawa <ki@epsilou.com>2009-05-12 13:27:45 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-05-12 13:27:45 +0200
commitaf498d7fa3e786f52650819a56e117ed9a40920c (patch)
tree4170275db90f306935e35be1c2cd2cbd6a1a27a8 /block/blk-core.c
parenta4d7749be5de4a7261bcbe3c7d96c748792ec455 (diff)
block: fix the bio_vec array index out-of-bounds test
Current bio_vec array index out-of-bounds test within __end_that_request_first() does not seem correct. It checks bio->bi_idx against bio->bi_vcnt, but the subsequent code uses idx (which is, bio->bi_idx + next_idx) as the array index into bio_vec array. This means that the test really make sense only at the first iteration of !(nr_bytes >=bio->bi_size) case (when next_idx == zero). Fix this by replacing bio->bi_idx with idx. (This patch applies to 2.6.30-rc4.) Signed-off-by: Kazuhisa Ichikawa <ki@epsilou.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'block/blk-core.c')
-rw-r--r--block/blk-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index 2998fe3a2377..c89883be8737 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1768,10 +1768,10 @@ static int __end_that_request_first(struct request *req, int error,
} else {
int idx = bio->bi_idx + next_idx;
- if (unlikely(bio->bi_idx >= bio->bi_vcnt)) {
+ if (unlikely(idx >= bio->bi_vcnt)) {
blk_dump_rq_flags(req, "__end_that");
printk(KERN_ERR "%s: bio idx %d >= vcnt %d\n",
- __func__, bio->bi_idx, bio->bi_vcnt);
+ __func__, idx, bio->bi_vcnt);
break;
}