From: Andreas Hindborg <a.hindborg@kernel.org>
To: Jens Axboe <axboe@kernel.dk>
Cc: Oliver Mangold <oliver.mangold@pm.me>,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
Andreas Hindborg <a.hindborg@kernel.org>
Subject: [PATCH] block: set bi_vcnt when cloning bio
Date: Sat, 15 Feb 2025 11:58:15 +0100 [thread overview]
Message-ID: <20250215-clone-bi_vcnt-v1-1-5d00c95fd53a@kernel.org> (raw)
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>
next reply other threads:[~2025-02-15 10:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-15 10:58 Andreas Hindborg [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250215-clone-bi_vcnt-v1-1-5d00c95fd53a@kernel.org \
--to=a.hindborg@kernel.org \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oliver.mangold@pm.me \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®