mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 05:55:44 +02:00
ANDROID: block: fix checking for wrapped key support
fscrypt isn't supposed to try to use inline encryption if the key is
wrapped but only blk-crypto-fallback is available. This logic got lost
when updating to the latest inline encryption patchset. Restore it in
blk_crypto_config_supported() where it should be now.
Also drop a redundant check from blk_crypto_fallback_bio_prep().
This fix should be folded into
ANDROID-block-add-hardware-wrapped-key-support.patch
Fixes: c2b86b727a ("FROMLIST: Update Inline Encryption from v6 to upstream version of patch series")
Change-Id: I4f8a32ee30d700b499da36e55e74d279a86bb779
Signed-off-by: Eric Biggers <ebiggers@google.com>
This commit is contained in:
parent
9ce5b474d6
commit
9c9596e980
|
|
@ -491,12 +491,6 @@ bool blk_crypto_fallback_bio_prep(struct bio **bio_ptr)
|
|||
struct bio_crypt_ctx *bc = bio->bi_crypt_context;
|
||||
struct bio_fallback_crypt_ctx *f_ctx;
|
||||
|
||||
if (bc->bc_key->crypto_cfg.is_hw_wrapped) {
|
||||
pr_warn_once("HW wrapped key cannot be used with fallback.\n");
|
||||
bio->bi_status = BLK_STS_NOTSUPP;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (WARN_ON_ONCE(!tfms_inited[bc->bc_key->crypto_cfg.crypto_mode])) {
|
||||
/* User didn't call blk_crypto_start_using_key() first */
|
||||
bio->bi_status = BLK_STS_IOERR;
|
||||
|
|
|
|||
|
|
@ -367,8 +367,10 @@ EXPORT_SYMBOL_GPL(blk_crypto_init_key);
|
|||
bool blk_crypto_config_supported(struct request_queue *q,
|
||||
const struct blk_crypto_config *cfg)
|
||||
{
|
||||
return IS_ENABLED(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) ||
|
||||
blk_ksm_crypto_cfg_supported(q->ksm, cfg);
|
||||
if (IS_ENABLED(CONFIG_BLK_INLINE_ENCRYPTION_FALLBACK) &&
|
||||
!cfg->is_hw_wrapped)
|
||||
return true;
|
||||
return blk_ksm_crypto_cfg_supported(q->ksm, cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user