public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: set bi_vcnt when cloning bio
@ 2025-02-15 10:58 Andreas Hindborg
  2025-02-18 10:40 ` John Garry
  2025-02-20  6:11 ` Christoph Hellwig
  0 siblings, 2 replies; 8+ messages in thread
From: Andreas Hindborg @ 2025-02-15 10:58 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Oliver Mangold, linux-block, linux-kernel, Andreas Hindborg

When cloning a bio, the `bio.bi_vcnt` field is not cloned. This is a
problem if users want to perform bounds checks on the `bio.bi_io_vec`
field.

Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
---
 block/bio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/bio.c b/block/bio.c
index f0c416e5931d9..334eedf312803 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -870,6 +870,7 @@ struct bio *bio_alloc_clone(struct block_device *bdev, struct bio *bio_src,
 		return NULL;
 	}
 	bio->bi_io_vec = bio_src->bi_io_vec;
+	bio->bi_vcnt = bio_src->bi_vcnt;
 
 	return bio;
 }

---
base-commit: a64dcfb451e254085a7daee5fe51bf22959d52d3
change-id: 20250215-clone-bi_vcnt-f3f770988894

Best regards,
-- 
Andreas Hindborg <a.hindborg@kernel.org>



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-02-20  6:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-15 10:58 [PATCH] block: set bi_vcnt when cloning bio Andreas Hindborg
2025-02-18 10:40 ` John Garry
2025-02-18 11:40   ` Andreas Hindborg
2025-02-18 17:12     ` John Garry
2025-02-18 18:20       ` Andreas Hindborg
2025-02-18 22:21       ` Bart Van Assche
2025-02-19 14:19         ` John Garry
2025-02-20  6:11 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox