From: Mengmeng Zhao Without native inline encryption, blk-crypto encrypts through the bio's data pages. A dma-buf bio has none, so fail it before the fallback runs. Devices with native support are not affected. The check can't wait for blk_mq_submit_bio(), as submitters reach the fallback before the bio is queued. No in-tree user submits such a bio today. Signed-off-by: Mengmeng Zhao Signed-off-by: Li Wang Signed-off-by: Anuj Gupta Signed-off-by: Nitesh Shetty --- block/blk-crypto.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/blk-crypto.c b/block/blk-crypto.c index bc3a9f59574b..01b8d26040dc 100644 --- a/block/blk-crypto.c +++ b/block/blk-crypto.c @@ -271,6 +271,14 @@ bool __blk_crypto_submit_bio(struct bio *bio) bio_endio_status(bio, BLK_STS_NOTSUPP); return false; } + /* + * The fallback encrypts from the data pages, which a dma-buf + * bio does not have. + */ + if (op_is_dmabuf(bio->bi_opf)) { + bio_endio_status(bio, BLK_STS_NOTSUPP); + return false; + } return blk_crypto_fallback_bio_prep(bio); } -- 2.47.3