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 Ie1b77f7615d6a7a60fdc9105c7ab2200d17636a8
Change-Id: I01aa7a04a5ab9c9e579bde8a06d095916d880e2c
Signed-off-by: Satya Tangirala <satyat@google.com>
tirimbino
Satya Tangirala 5 years ago
parent 138adbbe5e
commit 760b3283e8
  1. 5
      block/bio-crypt-ctx.c

@ -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);

Loading…
Cancel
Save