Thread (3 messages) 3 messages, 2 authors, 2020-11-20

Re: [PATCH v2] block/keyslot-manager: prevent crash when num_slots=1

From: Jens Axboe <axboe@kernel.dk>
Date: 2020-11-20 18:53:23
Also in: linux-fscrypt

On 11/11/20 2:48 PM, Eric Biggers wrote:
From: Eric Biggers <redacted>

If there is only one keyslot, then blk_ksm_init() computes
slot_hashtable_size=1 and log_slot_ht_size=0.  This causes
blk_ksm_find_keyslot() to crash later because it uses
hash_ptr(key, log_slot_ht_size) to find the hash bucket containing the
key, and hash_ptr() doesn't support the bits == 0 case.

Fix this by making the hash table always have at least 2 buckets.

Tested by running:

    kvm-xfstests -c ext4 -g encrypt -m inlinecrypt \
                 -o blk-crypto-fallback.num_keyslots=1
Applied for 5.10, thanks.

-- 
Jens Axboe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help