Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes froim Herbert Xu: "This fixes the following issues: - potential boot hang in hwrng - missing switch/break in talitos - bugs and warnings in hisilicon - build warning in inside-secure" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: hisilicon - avoid unused function warning hwrng: core - don't wait on add_early_randomness() crypto: hisilicon - Fix return value check in hisi_zip_acompress() crypto: hisilicon - Matching the dma address for dma_pool_free() crypto: hisilicon - Fix double free in sec_free_hw_sgl() crypto: inside-secure - Fix unused variable warning when CONFIG_PCI=n crypto: talitos - fix missing break in switch statement
This commit is contained in:
Коммит
3c6a6910a8
|
@ -68,7 +68,7 @@ static void add_early_randomness(struct hwrng *rng)
|
|||
size_t size = min_t(size_t, 16, rng_buffer_size());
|
||||
|
||||
mutex_lock(&reading_mutex);
|
||||
bytes_read = rng_get_data(rng, rng_buffer, size, 1);
|
||||
bytes_read = rng_get_data(rng, rng_buffer, size, 0);
|
||||
mutex_unlock(&reading_mutex);
|
||||
if (bytes_read > 0)
|
||||
add_device_randomness(rng_buffer, bytes_read);
|
||||
|
|
|
@ -153,6 +153,24 @@ static void sec_alg_skcipher_init_context(struct crypto_skcipher *atfm,
|
|||
ctx->cipher_alg);
|
||||
}
|
||||
|
||||
static void sec_free_hw_sgl(struct sec_hw_sgl *hw_sgl,
|
||||
dma_addr_t psec_sgl, struct sec_dev_info *info)
|
||||
{
|
||||
struct sec_hw_sgl *sgl_current, *sgl_next;
|
||||
dma_addr_t sgl_next_dma;
|
||||
|
||||
sgl_current = hw_sgl;
|
||||
while (sgl_current) {
|
||||
sgl_next = sgl_current->next;
|
||||
sgl_next_dma = sgl_current->next_sgl;
|
||||
|
||||
dma_pool_free(info->hw_sgl_pool, sgl_current, psec_sgl);
|
||||
|
||||
sgl_current = sgl_next;
|
||||
psec_sgl = sgl_next_dma;
|
||||
}
|
||||
}
|
||||
|
||||
static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl,
|
||||
dma_addr_t *psec_sgl,
|
||||
struct scatterlist *sgl,
|
||||
|
@ -199,35 +217,12 @@ static int sec_alloc_and_fill_hw_sgl(struct sec_hw_sgl **sec_sgl,
|
|||
return 0;
|
||||
|
||||
err_free_hw_sgls:
|
||||
sgl_current = *sec_sgl;
|
||||
while (sgl_current) {
|
||||
sgl_next = sgl_current->next;
|
||||
dma_pool_free(info->hw_sgl_pool, sgl_current,
|
||||
sgl_current->next_sgl);
|
||||
sgl_current = sgl_next;
|
||||
}
|
||||
sec_free_hw_sgl(*sec_sgl, *psec_sgl, info);
|
||||
*psec_sgl = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sec_free_hw_sgl(struct sec_hw_sgl *hw_sgl,
|
||||
dma_addr_t psec_sgl, struct sec_dev_info *info)
|
||||
{
|
||||
struct sec_hw_sgl *sgl_current, *sgl_next;
|
||||
|
||||
if (!hw_sgl)
|
||||
return;
|
||||
sgl_current = hw_sgl;
|
||||
while (sgl_current->next) {
|
||||
sgl_next = sgl_current->next;
|
||||
dma_pool_free(info->hw_sgl_pool, sgl_current,
|
||||
sgl_current->next_sgl);
|
||||
sgl_current = sgl_next;
|
||||
}
|
||||
dma_pool_free(info->hw_sgl_pool, hw_sgl, psec_sgl);
|
||||
}
|
||||
|
||||
static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm,
|
||||
const u8 *key, unsigned int keylen,
|
||||
enum sec_cipher_alg alg)
|
||||
|
|
|
@ -559,7 +559,7 @@ static int hisi_zip_acompress(struct acomp_req *acomp_req)
|
|||
struct hisi_zip_ctx *ctx = crypto_tfm_ctx(acomp_req->base.tfm);
|
||||
struct hisi_zip_qp_ctx *qp_ctx = &ctx->qp_ctx[QPC_COMP];
|
||||
struct hisi_zip_req *req;
|
||||
size_t head_size;
|
||||
int head_size;
|
||||
int ret;
|
||||
|
||||
/* let's output compression head now */
|
||||
|
@ -567,7 +567,7 @@ static int hisi_zip_acompress(struct acomp_req *acomp_req)
|
|||
if (head_size < 0)
|
||||
return -ENOMEM;
|
||||
|
||||
req = hisi_zip_create_req(acomp_req, qp_ctx, head_size, true);
|
||||
req = hisi_zip_create_req(acomp_req, qp_ctx, (size_t)head_size, true);
|
||||
if (IS_ERR(req))
|
||||
return PTR_ERR(req);
|
||||
|
||||
|
|
|
@ -785,7 +785,6 @@ static int hisi_zip_clear_vft_config(struct hisi_zip *hisi_zip)
|
|||
|
||||
static int hisi_zip_sriov_enable(struct pci_dev *pdev, int max_vfs)
|
||||
{
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
struct hisi_zip *hisi_zip = pci_get_drvdata(pdev);
|
||||
int pre_existing_vfs, num_vfs, ret;
|
||||
|
||||
|
@ -815,9 +814,6 @@ static int hisi_zip_sriov_enable(struct pci_dev *pdev, int max_vfs)
|
|||
}
|
||||
|
||||
return num_vfs;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int hisi_zip_sriov_disable(struct pci_dev *pdev)
|
||||
|
@ -948,7 +944,8 @@ static struct pci_driver hisi_zip_pci_driver = {
|
|||
.id_table = hisi_zip_dev_ids,
|
||||
.probe = hisi_zip_probe,
|
||||
.remove = hisi_zip_remove,
|
||||
.sriov_configure = hisi_zip_sriov_configure,
|
||||
.sriov_configure = IS_ENABLED(CONFIG_PCI_IOV) ?
|
||||
hisi_zip_sriov_configure : 0,
|
||||
.err_handler = &hisi_zip_err_handler,
|
||||
};
|
||||
|
||||
|
|
|
@ -1789,32 +1789,50 @@ static struct pci_driver safexcel_pci_driver = {
|
|||
};
|
||||
#endif
|
||||
|
||||
/* Unfortunately, we have to resort to global variables here */
|
||||
#if IS_ENABLED(CONFIG_PCI)
|
||||
int pcireg_rc = -EINVAL; /* Default safe value */
|
||||
#endif
|
||||
#if IS_ENABLED(CONFIG_OF)
|
||||
int ofreg_rc = -EINVAL; /* Default safe value */
|
||||
#endif
|
||||
|
||||
static int __init safexcel_init(void)
|
||||
{
|
||||
int rc;
|
||||
#if IS_ENABLED(CONFIG_PCI)
|
||||
/* Register PCI driver */
|
||||
pcireg_rc = pci_register_driver(&safexcel_pci_driver);
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_OF)
|
||||
/* Register platform driver */
|
||||
platform_driver_register(&crypto_safexcel);
|
||||
/* Register platform driver */
|
||||
ofreg_rc = platform_driver_register(&crypto_safexcel);
|
||||
#if IS_ENABLED(CONFIG_PCI)
|
||||
/* Return success if either PCI or OF registered OK */
|
||||
return pcireg_rc ? ofreg_rc : 0;
|
||||
#else
|
||||
return ofreg_rc;
|
||||
#endif
|
||||
#else
|
||||
#if IS_ENABLED(CONFIG_PCI)
|
||||
return pcireg_rc;
|
||||
#else
|
||||
return -EINVAL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_PCI)
|
||||
/* Register PCI driver */
|
||||
rc = pci_register_driver(&safexcel_pci_driver);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit safexcel_exit(void)
|
||||
{
|
||||
#if IS_ENABLED(CONFIG_OF)
|
||||
/* Unregister platform driver */
|
||||
/* Unregister platform driver */
|
||||
if (!ofreg_rc)
|
||||
platform_driver_unregister(&crypto_safexcel);
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_PCI)
|
||||
/* Unregister PCI driver if successfully registered before */
|
||||
/* Unregister PCI driver if successfully registered before */
|
||||
if (!pcireg_rc)
|
||||
pci_unregister_driver(&safexcel_pci_driver);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -3116,6 +3116,7 @@ static int talitos_remove(struct platform_device *ofdev)
|
|||
break;
|
||||
case CRYPTO_ALG_TYPE_AEAD:
|
||||
crypto_unregister_aead(&t_alg->algt.alg.aead);
|
||||
break;
|
||||
case CRYPTO_ALG_TYPE_AHASH:
|
||||
crypto_unregister_ahash(&t_alg->algt.alg.hash);
|
||||
break;
|
||||
|
|
Загрузка…
Ссылка в новой задаче