Patch "block: copy back bounce buffer to user-space correctly in case of split" has been added to the 6.12-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: copy back bounce buffer to user-space correctly in case of split

to the 6.12-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-copy-back-bounce-buffer-to-user-space-correctl.patch
and it can be found in the queue-6.12 subdirectory.

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



commit 35b2e45d84f9fe036a969756873af15d9d6c4fac
Author: Christoph Hellwig <hch@xxxxxx>
Date:   Thu Nov 28 16:52:32 2024 +0530

    block: copy back bounce buffer to user-space correctly in case of split
    
    [ Upstream commit 031141976be0bd5f385775727a4ed3cc845eb7ba ]
    
    Copy back the bounce buffer to user-space in entirety when the parent
    bio completes. The existing code uses bip_iter.bi_size for sizing the
    copy, which can be modified. So move away from that and fetch it from
    the vector passed to the block layer. While at it, switch to using
    better variable names.
    
    Fixes: 492c5d455969f ("block: bio-integrity: directly map user buffers")
    Signed-off-by: Christoph Hellwig <hch@xxxxxx>
    Signed-off-by: Anuj Gupta <anuj20.g@xxxxxxxxxxx>
    Reviewed-by: Keith Busch <kbusch@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241128112240.8867-3-anuj20.g@xxxxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index 88e3ad73c3854..9aed61fcd0bf9 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -118,17 +118,18 @@ static void bio_integrity_unpin_bvec(struct bio_vec *bv, int nr_vecs,
 
 static void bio_integrity_uncopy_user(struct bio_integrity_payload *bip)
 {
-	unsigned short nr_vecs = bip->bip_max_vcnt - 1;
-	struct bio_vec *copy = &bip->bip_vec[1];
-	size_t bytes = bip->bip_iter.bi_size;
-	struct iov_iter iter;
+	unsigned short orig_nr_vecs = bip->bip_max_vcnt - 1;
+	struct bio_vec *orig_bvecs = &bip->bip_vec[1];
+	struct bio_vec *bounce_bvec = &bip->bip_vec[0];
+	size_t bytes = bounce_bvec->bv_len;
+	struct iov_iter orig_iter;
 	int ret;
 
-	iov_iter_bvec(&iter, ITER_DEST, copy, nr_vecs, bytes);
-	ret = copy_to_iter(bvec_virt(bip->bip_vec), bytes, &iter);
+	iov_iter_bvec(&orig_iter, ITER_DEST, orig_bvecs, orig_nr_vecs, bytes);
+	ret = copy_to_iter(bvec_virt(bounce_bvec), bytes, &orig_iter);
 	WARN_ON_ONCE(ret != bytes);
 
-	bio_integrity_unpin_bvec(copy, nr_vecs, true);
+	bio_integrity_unpin_bvec(orig_bvecs, orig_nr_vecs, true);
 }
 
 /**




[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