aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/bio.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/block/bio.c b/block/bio.c
index f5002b44c963..28f66e2edc53 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1333,7 +1333,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
1333 int j; 1333 int j;
1334 struct bio *bio; 1334 struct bio *bio;
1335 int ret; 1335 int ret;
1336 struct iov_iter i;
1337 struct bio_vec *bvec; 1336 struct bio_vec *bvec;
1338 1337
1339 if (!iov_iter_count(iter)) 1338 if (!iov_iter_count(iter))
@@ -1343,14 +1342,13 @@ struct bio *bio_map_user_iov(struct request_queue *q,
1343 if (!bio) 1342 if (!bio)
1344 return ERR_PTR(-ENOMEM); 1343 return ERR_PTR(-ENOMEM);
1345 1344
1346 i = *iter; 1345 while (iov_iter_count(iter)) {
1347 while (iov_iter_count(&i)) {
1348 struct page **pages; 1346 struct page **pages;
1349 ssize_t bytes; 1347 ssize_t bytes;
1350 size_t offs, added = 0; 1348 size_t offs, added = 0;
1351 int npages; 1349 int npages;
1352 1350
1353 bytes = iov_iter_get_pages_alloc(&i, &pages, LONG_MAX, &offs); 1351 bytes = iov_iter_get_pages_alloc(iter, &pages, LONG_MAX, &offs);
1354 if (unlikely(bytes <= 0)) { 1352 if (unlikely(bytes <= 0)) {
1355 ret = bytes ? bytes : -EFAULT; 1353 ret = bytes ? bytes : -EFAULT;
1356 goto out_unmap; 1354 goto out_unmap;
@@ -1384,7 +1382,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
1384 bytes -= n; 1382 bytes -= n;
1385 offs = 0; 1383 offs = 0;
1386 } 1384 }
1387 iov_iter_advance(&i, added); 1385 iov_iter_advance(iter, added);
1388 } 1386 }
1389 /* 1387 /*
1390 * release the pages we didn't map into the bio, if any 1388 * release the pages we didn't map into the bio, if any
@@ -1406,7 +1404,6 @@ struct bio *bio_map_user_iov(struct request_queue *q,
1406 * reference to it 1404 * reference to it
1407 */ 1405 */
1408 bio_get(bio); 1406 bio_get(bio);
1409 iov_iter_advance(iter, bio->bi_iter.bi_size);
1410 return bio; 1407 return bio;
1411 1408
1412 out_unmap: 1409 out_unmap: