@@ -218,6 +218,7 @@ static int bio_copy_user_iov(struct requ
ret = bio_copy_from_iter(bio, &iter2);
if (ret)
goto cleanup;
+ iov_iter_truncate(iter, iov_iter_count(&iter2));
} else {
if (bmd->is_our_pages)
zero_fill_bio(bio);
or following patch, save iter's data_source before copying, restore iter's data_source later:
@@ -211,11 +211,12 @@
if (ret)
goto cleanup;
} else if (map_data && map_data->from_user) {
- struct iov_iter iter2 = *iter;
+ bool data_source = iter->data_source;
/* This is the copy-in part of SG_DXFER_TO_FROM_DEV. */
- iter2.data_source = ITER_SOURCE;
- ret = bio_copy_from_iter(bio, &iter2);
+ iter->data_source = ITER_SOURCE;
+ ret = bio_copy_from_iter(bio, iter);
+ iter->data_source = data_source;
if (ret)
goto cleanup;
} else {