blk-mq: return actual keyslot error in blk_insert_cloned_request()
authorEric Biggers <ebiggers@google.com>
Wed, 15 Mar 2023 18:39:06 +0000 (11:39 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 16 Mar 2023 15:35:09 +0000 (09:35 -0600)
To avoid hiding information, pass on the error code from
blk_crypto_rq_get_keyslot() instead of always using BLK_STS_IOERR.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20230315183907.53675-2-ebiggers@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index 5e819de2f5e7028de4f2c24d8f0433a28109de62..a875b1cdff9b5bc1f44541b5630d00eaccfc1a58 100644 (file)
@@ -3049,8 +3049,9 @@ blk_status_t blk_insert_cloned_request(struct request *rq)
        if (q->disk && should_fail_request(q->disk->part0, blk_rq_bytes(rq)))
                return BLK_STS_IOERR;
 
-       if (blk_crypto_rq_get_keyslot(rq))
-               return BLK_STS_IOERR;
+       ret = blk_crypto_rq_get_keyslot(rq);
+       if (ret != BLK_STS_OK)
+               return ret;
 
        blk_account_io_start(rq);