On Fri, Dec 19, 2025 at 12:08:37PM -0800, Eric Biggers wrote:
> Actually I think using bi_max_vecs is broken.
> 
> This code assumes that bi_max_vecs matches the nr_segs that was passed
> to bio_alloc_bioset().
> 
> That assumption is incorrect, though.  If nr_segs > 0 && nr_segs <
> BIO_INLINE_VECS, bio_alloc_bioset() sets bi_max_vecs to BIO_INLINE_VECS.
> BIO_INLINE_VECS is 4.
> 
> I think blk_crypto_alloc_enc_bio() will need to return a nr_enc_pages
> value.  That value will need to be used above as well as at
> out_free_enc_bio, instead of bi_max_vecs.

A bigger bi_max_vecs should not a problem as we still have a terminating
condition based on the source bio iterator.  That being said I agree
it is not very nice, and I've reworked the code to keep a variable
counting the segments in the encrypted bio.


Reply via email to