-----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEEwPw5LcreJtl1+l5K99NY+ylx4KYFAl/BY/cQHGF4Ym9lQGtl
 cm5lbC5kawAKCRD301j7KXHgpsefD/4kziIls40BV9DiJzJKoTZspItwqe1nXzJQ
 9P23S/46meYu9Io4rvIpZWKS/1NdYCHhpXbK+AEBMFhLQlTxwhalTbfC8KxnNTdf
 Wo2nqmKhKG3ccbXE84R5HilyH2McxEf6XYyIGgyuOtEgiW+tP/4JMVhOpSO/OL+Z
 RzJ7QnT+5Coq4E05qqrSiTWdoR7bKVeGYkaMZPqUlDbaV+BCCRCvPbIeDYQnAlyG
 3F+6ZPTox9dOeDWcJhggJtBXCh6hBIH08zVqlaY82KCfvjmwzjjmnw/4O/z3lVAN
 Xa8Z0xbnGgOYblrpaa9cWDp8h78KT98N0KgDEv0nvyD3E3q2hd+uCh/NIqwGCqOL
 ZcJO3KxZEqDiO9YCMJGUoRXvOdgwV7bNj5LdAVisSp5DpESkBMg/YKY2EwXHoNUm
 +TcO4V3sC4c1GPc7cG8PSLxVpFnqfDRDjIC4+ZTs/WPLkmERxx9C3FBAhXsmT6W/
 3z3+OZqf8QMNFa0Yb7rpQUORAJdSvY1vBO3qZdtz0U7e5dZvSMPZWI5tHvMvQLfh
 FnQmnrvw0D8eED30PHSIjiehWizRR1haGUitYD4RuAGRWMZK6zb5R/Pf+b0sphWB
 mLZWLIjnkGxvHqGVXVoYN58xFtz70mSvRe1hItMfV0MgN7o3ZtXScxzLUyNdCwDt
 yeHpIpODJw==
 =E8f5
 -----END PGP SIGNATURE-----

Merge tag 'block-5.10-2020-11-27' of git://git.kernel.dk/linux-block

Pull block fix from Jens Axboe:
 "Just a single fix, for a crash in the keyslot manager"

* tag 'block-5.10-2020-11-27' of git://git.kernel.dk/linux-block:
  block/keyslot-manager: prevent crash when num_slots=1
This commit is contained in:
Linus Torvalds 2020-11-27 12:49:01 -08:00
Родитель a17a3ca55e 47a846536e
Коммит d021c3e56d
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -103,6 +103,13 @@ int blk_ksm_init(struct blk_keyslot_manager *ksm, unsigned int num_slots)
spin_lock_init(&ksm->idle_slots_lock);
slot_hashtable_size = roundup_pow_of_two(num_slots);
/*
* hash_ptr() assumes bits != 0, so ensure the hash table has at least 2
* buckets. This only makes a difference when there is only 1 keyslot.
*/
if (slot_hashtable_size < 2)
slot_hashtable_size = 2;
ksm->log_slot_ht_size = ilog2(slot_hashtable_size);
ksm->slot_hashtable = kvmalloc_array(slot_hashtable_size,
sizeof(ksm->slot_hashtable[0]),