]> git.itanic.dy.fi Git - linux-stable/commitdiff
Fix bug in blk_rq_merge_ok
authorWenbo Wang <wenbo.wang@memblaze.com>
Fri, 20 Mar 2015 05:04:54 +0000 (01:04 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Apr 2015 08:10:12 +0000 (10:10 +0200)
commit 7ee8e4f3983c4ff700958a6099c8fd212ea67b94 upstream.

Use the right array index to reference the last
element of rq->biotail->bi_io_vec[]

Signed-off-by: Wenbo Wang <wenbo.wang@memblaze.com>
Reviewed-by: Chong Yuan <chong.yuan@memblaze.com>
Fixes: 66cb45aa41315 ("block: add support for limiting gaps in SG lists")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
block/blk-merge.c

index 89b97b5e0881853054c0807c5607c20d91d90762..2be75ff7f171dc94163503f5d4ccfde796593607 100644 (file)
@@ -609,7 +609,7 @@ bool blk_rq_merge_ok(struct request *rq, struct bio *bio)
        if (q->queue_flags & (1 << QUEUE_FLAG_SG_GAPS)) {
                struct bio_vec *bprev;
 
-               bprev = &rq->biotail->bi_io_vec[bio->bi_vcnt - 1];
+               bprev = &rq->biotail->bi_io_vec[rq->biotail->bi_vcnt - 1];
                if (bvec_gap_to_prev(bprev, bio->bi_io_vec[0].bv_offset))
                        return false;
        }