Re: [PATCH 8/9] blk-crypto: use on-stack skciphers for fallback en/decryption

Christoph Hellwig
2025-11-14T05:57:29Z

On Thu, Nov 13, 2025 at 04:32:00PM -0800, Eric Biggers wrote:
> > */
> > -void blk_crypto_fallback_encrypt_bio(struct bio *src_bio)
>
> The above comment needs to be updated too. Maybe leave the static
> function __blk_crypto_fallback_encrypt_bio() uncommented, and write an
> updated comment for the global function
> blk_crypto_fallback_encrypt_bio(). Maybe something like this:

Make sense.

> > + struct bio *bio = f_ctx->bio;
> > + struct bio_crypt_ctx *bc = &f_ctx->crypt_ctx;
> > + struct blk_crypto_keyslot *slot;
> > + blk_status_t status;
> > +
> > + status = blk_crypto_get_keyslot(blk_crypto_fallback_profile,
> > + bc->bc_key, &slot);
> > + if (status == BLK_STS_OK) {
> > + status = __blk_crypto_fallback_decrypt_bio(f_ctx->bio,
> > + &f_ctx->crypt_ctx, f_ctx->crypt_iter,
> > + blk_crypto_fallback_tfm(slot));
> > + blk_crypto_put_keyslot(slot);
> > + }
>
> This is referencing f_ctx->bio and f_ctx->crypt_ctx when they were
> already loaded into local variables. Either the local variables should
> be used, or they should be removed and the fields always used.

Yeah, I actually noticed that myself after sending out the series.