From: Mengmeng Zhao <redacted>
A dma-buf bio has no pages for the crypto layer to walk: the
software fallback would read the map as bio_vecs. Refuse it in
blk_mq_submit_bio() before it can reach that path.
Signed-off-by: Mengmeng Zhao <redacted>
Signed-off-by: Li Wang <redacted>
---
block/blk-mq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index be5671966787..f0d978b1724f 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3138,8 +3138,10 @@ void blk_mq_submit_bio(struct bio *bio)
goto queue_exit;
}
+ /* a dma-buf bio has no pages for integrity work or contents crypto */
if (unlikely(op_is_dmabuf(bio->bi_opf) &&
- bdev_has_integrity_csum(bio->bi_bdev))) {
+ (bdev_has_integrity_csum(bio->bi_bdev) ||
+ bio_has_crypt_ctx(bio)))) {
bio_endio_status(bio, BLK_STS_NOTSUPP);
goto queue_exit;
}--
2.43.0