On Wed, Dec 10, 2025 at 04:23:37PM +0100, Christoph Hellwig wrote:
> diff --git a/block/blk-merge.c b/block/blk-merge.c
> index 6cea8fb3e968..829ee288065a 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -326,9 +326,16 @@ int bio_split_io_at(struct bio *bio, const struct
> queue_limits *lim,
> struct bio_vec bv, bvprv, *bvprvp = NULL;
> unsigned nsegs = 0, bytes = 0, gaps = 0;
> struct bvec_iter iter;
> + unsigned len_align_mask = lim->dma_alignment;
> +
> + if (bio_has_crypt_ctx(bio)) {
> + struct bio_crypt_ctx *bc = bio->bi_crypt_context;
> +
> + len_align_mask |= (bc->bc_key->crypto_cfg.data_unit_size - 1);
> + }
Needs an #ifdef CONFIG_BLK_INLINE_ENCRYPTION, since ->bi_crypt_context
is conditional on it.
>
> bio_for_each_bvec(bv, bio, iter) {
> - if (bv.bv_offset & lim->dma_alignment)
> + if (bv.bv_offset & len_align_mask)
> return -EINVAL;
As I mentioned on patch 3, I'm confused where the check of bv_len went
here. Isn't it still needed?
I think this patch is also affected by the issue I mentioned on patch 7,
where the error handling at 'out_free_bounce_pages' is not correct.
The high-level approach seems okay, though.
- Eric