Patch "block: ensure iov_iter advances for added pages" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    block: ensure iov_iter advances for added pages

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     block-ensure-iov_iter-advances-for-added-pages.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7eed6dd4d3cc42f050ab82c5a62a447db1cd4734
Author: Keith Busch <kbusch@xxxxxxxxxx>
Date:   Tue Jul 12 08:32:54 2022 -0700

    block: ensure iov_iter advances for added pages
    
    [ Upstream commit 325347d965e7ccf5424a05398807a6d801846612 ]
    
    There are cases where a bio may not accept additional pages, and the iov
    needs to advance to the last data length that was accepted. The zone
    append used to handle this correctly, but was inadvertently broken when
    the setup was made common with the normal r/w case.
    
    Fixes: 576ed9135489c ("block: use bio_add_page in bio_iov_iter_get_pages")
    Fixes: c58c0074c54c2 ("block/bio: remove duplicate append pages code")
    Signed-off-by: Keith Busch <kbusch@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220712153256.2202024-1-kbusch@xxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/bio.c b/block/bio.c
index 6f6e6e23889c..7d4d5723350b 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -1181,6 +1181,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
 	ssize_t size, left;
 	unsigned len, i;
 	size_t offset;
+	int ret = 0;
 
 	/*
 	 * Move page array up in the allocated memory for the bio vecs as far as
@@ -1196,7 +1197,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
 
 	for (left = size, i = 0; left > 0; left -= len, i++) {
 		struct page *page = pages[i];
-		int ret;
 
 		len = min_t(size_t, PAGE_SIZE - offset, left);
 		if (bio_op(bio) == REQ_OP_ZONE_APPEND)
@@ -1207,13 +1207,13 @@ static int __bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter)
 
 		if (ret) {
 			bio_put_pages(pages + i, left, offset);
-			return ret;
+			break;
 		}
 		offset = 0;
 	}
 
-	iov_iter_advance(iter, size);
-	return 0;
+	iov_iter_advance(iter, size - left);
+	return ret;
 }
 
 /**



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux