ANDROID: block: Fix bio_crypt_should_process WARN_ON

bio_crypt_should_process would WARN that the bio did not have a
keyslot in any keyslot manager even when we were on the decrypt path
of blk-crypto, which is a bug. The WARN is now conditional on the
caller being responible for handling encryption rather than blk-crypto
(i.e. the WARN happens only if this function return true).

Bug: 137270441
Test: tested as series; see I26aac0ac7845a9064f28bb1421eb2522828a6dec
Change-Id: Id7ef6b066d43bebae146b28edc76e506c7b03235
Signed-off-by: Satya Tangirala <satyat@google.com>
This commit is contained in:
Satya Tangirala 2019-11-07 16:23:25 -08:00 committed by Alistair Delva
parent 20efc30a3e
commit 8fda305325

View File

@ -65,8 +65,11 @@ bool bio_crypt_should_process(struct bio *bio, struct request_queue *q)
if (!bio_has_crypt_ctx(bio))
return false;
if (q->ksm != bio->bi_crypt_context->processing_ksm)
return false;
WARN_ON(!bio_crypt_has_keyslot(bio));
return q->ksm == bio->bi_crypt_context->processing_ksm;
return true;
}
EXPORT_SYMBOL(bio_crypt_should_process);