Skip to content

Commit

Permalink
bounce: don't rely on a zeroed bio_vec list
Browse files Browse the repository at this point in the history
__blk_queue_bounce() relies on a zeroed bio_vec list, since it looks
up arbitrary indexes in the allocated bio. The block layer only
guarentees that added entries are valid, so clear memory after alloc.

Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
Jens Axboe committed Dec 29, 2008
1 parent a0ea862 commit f735b5e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mm/bounce.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,13 @@ static void __blk_queue_bounce(struct request_queue *q, struct bio **bio_orig,
/*
* irk, bounce it
*/
if (!bio)
bio = bio_alloc(GFP_NOIO, (*bio_orig)->bi_vcnt);
if (!bio) {
unsigned int cnt = (*bio_orig)->bi_vcnt;

bio = bio_alloc(GFP_NOIO, cnt);
memset(bio->bi_io_vec, 0, cnt * sizeof(struct bio_vec));
}


to = bio->bi_io_vec + i;

Expand Down

0 comments on commit f735b5e

Please sign in to comment.