[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <503E4E5F.5060003@kernel.dk>
Date: Wed, 29 Aug 2012 10:16:15 -0700
From: Jens Axboe <axboe@...nel.dk>
To: "Martin K. Petersen" <martin.petersen@...cle.com>
CC: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] block: Fix bad range check in bio_sector_offset
On 2012-08-28 11:03, Martin K. Petersen wrote:
>
> DM would occasionally end up splitting data integrity-enabled requests
> incorrectly. The culprit was a bad range check in bio_sector_offset.
>
> Signed-off-by: Martin K. Petersen <martin.petersen@...cle.com>
> Cc: <stable@...r.kernel.org>
>
> diff --git a/fs/bio.c b/fs/bio.c
> index 9bfade8..b9a6744 100644
> --- a/fs/bio.c
> +++ b/fs/bio.c
> @@ -1552,8 +1552,8 @@ sector_t bio_sector_offset(struct bio *bio, unsigned short index,
> sector_sz = queue_logical_block_size(bio->bi_bdev->bd_disk->queue);
> sectors = 0;
>
> - if (index >= bio->bi_idx)
> - index = bio->bi_vcnt - 1;
> + if (index > bio->bi_vcnt)
> + return 0;
>
> __bio_for_each_segment(bv, bio, i, 0) {
> if (i == index) {
Good catch, merged.
--
Jens Axboe
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists