diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2024-05-27 11:58:50 -0400 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2024-06-10 11:05:43 +0200 |
commit | af206c284e4c1b17cdfb0f17e898b288c0fc1751 (patch) | |
tree | 8d7d52c0e2607723c8bc35689743f583cb55aefe /crypto/block-qcow.c | |
parent | 24687abf237e3c15816d689a8e4b08d7c3190dcb (diff) |
block/crypto: create ciphers on demand
Ciphers are pre-allocated by qcrypto_block_init_cipher() depending on
the given number of threads. The -device
virtio-blk-pci,iothread-vq-mapping= feature allows users to assign
multiple IOThreads to a virtio-blk device, but the association between
the virtio-blk device and the block driver happens after the block
driver is already open.
When the number of threads given to qcrypto_block_init_cipher() is
smaller than the actual number of threads at runtime, the
block->n_free_ciphers > 0 assertion in qcrypto_block_pop_cipher() can
fail.
Get rid of qcrypto_block_init_cipher() n_thread's argument and allocate
ciphers on demand.
Reported-by: Qing Wang <qinwang@redhat.com>
Buglink: https://issues.redhat.com/browse/RHEL-36159
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240527155851.892885-2-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'crypto/block-qcow.c')
-rw-r--r-- | crypto/block-qcow.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/block-qcow.c b/crypto/block-qcow.c index 4d7cf36a8f..02305058e3 100644 --- a/crypto/block-qcow.c +++ b/crypto/block-qcow.c @@ -75,7 +75,7 @@ qcrypto_block_qcow_init(QCryptoBlock *block, ret = qcrypto_block_init_cipher(block, QCRYPTO_CIPHER_ALG_AES_128, QCRYPTO_CIPHER_MODE_CBC, keybuf, G_N_ELEMENTS(keybuf), - n_threads, errp); + errp); if (ret < 0) { ret = -ENOTSUP; goto fail; |