Fix _blockdev_set_bio_data iteration
The data->size field can be initialized to a lower value than bio->bi_vcnt, if the bio is split. The bio_for_each_segment then iterates based on the original indexes and the mismatch eventually causes a BUG_ON. Fixes #714 Signed-off-by: Kozlowski Mateusz <mateusz.kozlowski@intel.com>
This commit is contained in:
parent
301854ae39
commit
a45f0c854f
@ -38,11 +38,12 @@ static void _blockdev_set_bio_data(struct blk_data *data, struct bio *bio)
|
|||||||
{
|
{
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
|
||||||
struct bio_vec *bvec;
|
struct bio_vec *bvec;
|
||||||
uint32_t i = 0;
|
uint32_t iter = 0, i = 0;
|
||||||
|
|
||||||
bio_for_each_segment(bvec, bio, i) {
|
bio_for_each_segment(bvec, bio, iter) {
|
||||||
BUG_ON(i >= data->size);
|
BUG_ON(i >= data->size);
|
||||||
data->vec[i] = *bvec;
|
data->vec[i] = *bvec;
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
struct bio_vec bvec;
|
struct bio_vec bvec;
|
||||||
|
Loading…
Reference in New Issue
Block a user