diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-26 21:05:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-26 21:05:23 -0400 |
commit | d8cc3972b2178f9fe532306330f76bf51cb0d8bd (patch) | |
tree | 9e16fc4ff9ad97d1d5f1f9a2a261a356167ef5eb | |
parent | c91d7072952993f96896c2fc9868f55924e7ba6c (diff) | |
parent | 09185e2756a83763bcbfe51b308b85979f0de027 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu:
"This fixes the following issues:
- check the return value of platform_get_irq as signed int in xgene.
- skip adf_dev_restore on virtual functions in qat.
- fix double-free with backlogged requests in marvell_cesa"
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
hwrng: xgene - fix handling platform_get_irq
crypto: qat - VF should never trigger SBR on PH
crypto: marvell - properly handle CRYPTO_TFM_REQ_MAY_BACKLOG-flagged requests
-rw-r--r-- | drivers/char/hw_random/xgene-rng.c | 7 | ||||
-rw-r--r-- | drivers/crypto/marvell/cesa.h | 27 | ||||
-rw-r--r-- | drivers/crypto/marvell/cipher.c | 7 | ||||
-rw-r--r-- | drivers/crypto/marvell/hash.c | 8 | ||||
-rw-r--r-- | drivers/crypto/qat/qat_common/adf_aer.c | 3 |
5 files changed, 40 insertions, 12 deletions
diff --git a/drivers/char/hw_random/xgene-rng.c b/drivers/char/hw_random/xgene-rng.c index c37cf754a985..3c77645405e5 100644 --- a/drivers/char/hw_random/xgene-rng.c +++ b/drivers/char/hw_random/xgene-rng.c | |||
@@ -344,11 +344,12 @@ static int xgene_rng_probe(struct platform_device *pdev) | |||
344 | if (IS_ERR(ctx->csr_base)) | 344 | if (IS_ERR(ctx->csr_base)) |
345 | return PTR_ERR(ctx->csr_base); | 345 | return PTR_ERR(ctx->csr_base); |
346 | 346 | ||
347 | ctx->irq = platform_get_irq(pdev, 0); | 347 | rc = platform_get_irq(pdev, 0); |
348 | if (ctx->irq < 0) { | 348 | if (rc < 0) { |
349 | dev_err(&pdev->dev, "No IRQ resource\n"); | 349 | dev_err(&pdev->dev, "No IRQ resource\n"); |
350 | return ctx->irq; | 350 | return rc; |
351 | } | 351 | } |
352 | ctx->irq = rc; | ||
352 | 353 | ||
353 | dev_dbg(&pdev->dev, "APM X-Gene RNG BASE %p ALARM IRQ %d", | 354 | dev_dbg(&pdev->dev, "APM X-Gene RNG BASE %p ALARM IRQ %d", |
354 | ctx->csr_base, ctx->irq); | 355 | ctx->csr_base, ctx->irq); |
diff --git a/drivers/crypto/marvell/cesa.h b/drivers/crypto/marvell/cesa.h index b60698b30d30..bc2a55bc35e4 100644 --- a/drivers/crypto/marvell/cesa.h +++ b/drivers/crypto/marvell/cesa.h | |||
@@ -687,6 +687,33 @@ static inline u32 mv_cesa_get_int_mask(struct mv_cesa_engine *engine) | |||
687 | 687 | ||
688 | int mv_cesa_queue_req(struct crypto_async_request *req); | 688 | int mv_cesa_queue_req(struct crypto_async_request *req); |
689 | 689 | ||
690 | /* | ||
691 | * Helper function that indicates whether a crypto request needs to be | ||
692 | * cleaned up or not after being enqueued using mv_cesa_queue_req(). | ||
693 | */ | ||
694 | static inline int mv_cesa_req_needs_cleanup(struct crypto_async_request *req, | ||
695 | int ret) | ||
696 | { | ||
697 | /* | ||
698 | * The queue still had some space, the request was queued | ||
699 | * normally, so there's no need to clean it up. | ||
700 | */ | ||
701 | if (ret == -EINPROGRESS) | ||
702 | return false; | ||
703 | |||
704 | /* | ||
705 | * The queue had not space left, but since the request is | ||
706 | * flagged with CRYPTO_TFM_REQ_MAY_BACKLOG, it was added to | ||
707 | * the backlog and will be processed later. There's no need to | ||
708 | * clean it up. | ||
709 | */ | ||
710 | if (ret == -EBUSY && req->flags & CRYPTO_TFM_REQ_MAY_BACKLOG) | ||
711 | return false; | ||
712 | |||
713 | /* Request wasn't queued, we need to clean it up */ | ||
714 | return true; | ||
715 | } | ||
716 | |||
690 | /* TDMA functions */ | 717 | /* TDMA functions */ |
691 | 718 | ||
692 | static inline void mv_cesa_req_dma_iter_init(struct mv_cesa_dma_iter *iter, | 719 | static inline void mv_cesa_req_dma_iter_init(struct mv_cesa_dma_iter *iter, |
diff --git a/drivers/crypto/marvell/cipher.c b/drivers/crypto/marvell/cipher.c index 0745cf3b9c0e..3df2f4e7adb2 100644 --- a/drivers/crypto/marvell/cipher.c +++ b/drivers/crypto/marvell/cipher.c | |||
@@ -189,7 +189,6 @@ static inline void mv_cesa_ablkcipher_prepare(struct crypto_async_request *req, | |||
189 | { | 189 | { |
190 | struct ablkcipher_request *ablkreq = ablkcipher_request_cast(req); | 190 | struct ablkcipher_request *ablkreq = ablkcipher_request_cast(req); |
191 | struct mv_cesa_ablkcipher_req *creq = ablkcipher_request_ctx(ablkreq); | 191 | struct mv_cesa_ablkcipher_req *creq = ablkcipher_request_ctx(ablkreq); |
192 | |||
193 | creq->req.base.engine = engine; | 192 | creq->req.base.engine = engine; |
194 | 193 | ||
195 | if (creq->req.base.type == CESA_DMA_REQ) | 194 | if (creq->req.base.type == CESA_DMA_REQ) |
@@ -431,7 +430,7 @@ static int mv_cesa_des_op(struct ablkcipher_request *req, | |||
431 | return ret; | 430 | return ret; |
432 | 431 | ||
433 | ret = mv_cesa_queue_req(&req->base); | 432 | ret = mv_cesa_queue_req(&req->base); |
434 | if (ret && ret != -EINPROGRESS) | 433 | if (mv_cesa_req_needs_cleanup(&req->base, ret)) |
435 | mv_cesa_ablkcipher_cleanup(req); | 434 | mv_cesa_ablkcipher_cleanup(req); |
436 | 435 | ||
437 | return ret; | 436 | return ret; |
@@ -551,7 +550,7 @@ static int mv_cesa_des3_op(struct ablkcipher_request *req, | |||
551 | return ret; | 550 | return ret; |
552 | 551 | ||
553 | ret = mv_cesa_queue_req(&req->base); | 552 | ret = mv_cesa_queue_req(&req->base); |
554 | if (ret && ret != -EINPROGRESS) | 553 | if (mv_cesa_req_needs_cleanup(&req->base, ret)) |
555 | mv_cesa_ablkcipher_cleanup(req); | 554 | mv_cesa_ablkcipher_cleanup(req); |
556 | 555 | ||
557 | return ret; | 556 | return ret; |
@@ -693,7 +692,7 @@ static int mv_cesa_aes_op(struct ablkcipher_request *req, | |||
693 | return ret; | 692 | return ret; |
694 | 693 | ||
695 | ret = mv_cesa_queue_req(&req->base); | 694 | ret = mv_cesa_queue_req(&req->base); |
696 | if (ret && ret != -EINPROGRESS) | 695 | if (mv_cesa_req_needs_cleanup(&req->base, ret)) |
697 | mv_cesa_ablkcipher_cleanup(req); | 696 | mv_cesa_ablkcipher_cleanup(req); |
698 | 697 | ||
699 | return ret; | 698 | return ret; |
diff --git a/drivers/crypto/marvell/hash.c b/drivers/crypto/marvell/hash.c index ae9272eb9c1a..e8d0d7128137 100644 --- a/drivers/crypto/marvell/hash.c +++ b/drivers/crypto/marvell/hash.c | |||
@@ -739,10 +739,8 @@ static int mv_cesa_ahash_update(struct ahash_request *req) | |||
739 | return 0; | 739 | return 0; |
740 | 740 | ||
741 | ret = mv_cesa_queue_req(&req->base); | 741 | ret = mv_cesa_queue_req(&req->base); |
742 | if (ret && ret != -EINPROGRESS) { | 742 | if (mv_cesa_req_needs_cleanup(&req->base, ret)) |
743 | mv_cesa_ahash_cleanup(req); | 743 | mv_cesa_ahash_cleanup(req); |
744 | return ret; | ||
745 | } | ||
746 | 744 | ||
747 | return ret; | 745 | return ret; |
748 | } | 746 | } |
@@ -766,7 +764,7 @@ static int mv_cesa_ahash_final(struct ahash_request *req) | |||
766 | return 0; | 764 | return 0; |
767 | 765 | ||
768 | ret = mv_cesa_queue_req(&req->base); | 766 | ret = mv_cesa_queue_req(&req->base); |
769 | if (ret && ret != -EINPROGRESS) | 767 | if (mv_cesa_req_needs_cleanup(&req->base, ret)) |
770 | mv_cesa_ahash_cleanup(req); | 768 | mv_cesa_ahash_cleanup(req); |
771 | 769 | ||
772 | return ret; | 770 | return ret; |
@@ -791,7 +789,7 @@ static int mv_cesa_ahash_finup(struct ahash_request *req) | |||
791 | return 0; | 789 | return 0; |
792 | 790 | ||
793 | ret = mv_cesa_queue_req(&req->base); | 791 | ret = mv_cesa_queue_req(&req->base); |
794 | if (ret && ret != -EINPROGRESS) | 792 | if (mv_cesa_req_needs_cleanup(&req->base, ret)) |
795 | mv_cesa_ahash_cleanup(req); | 793 | mv_cesa_ahash_cleanup(req); |
796 | 794 | ||
797 | return ret; | 795 | return ret; |
diff --git a/drivers/crypto/qat/qat_common/adf_aer.c b/drivers/crypto/qat/qat_common/adf_aer.c index a57b4194de28..0a5ca0ba5d64 100644 --- a/drivers/crypto/qat/qat_common/adf_aer.c +++ b/drivers/crypto/qat/qat_common/adf_aer.c | |||
@@ -88,6 +88,9 @@ static void adf_dev_restore(struct adf_accel_dev *accel_dev) | |||
88 | struct pci_dev *parent = pdev->bus->self; | 88 | struct pci_dev *parent = pdev->bus->self; |
89 | uint16_t bridge_ctl = 0; | 89 | uint16_t bridge_ctl = 0; |
90 | 90 | ||
91 | if (accel_dev->is_vf) | ||
92 | return; | ||
93 | |||
91 | dev_info(&GET_DEV(accel_dev), "Resetting device qat_dev%d\n", | 94 | dev_info(&GET_DEV(accel_dev), "Resetting device qat_dev%d\n", |
92 | accel_dev->accel_id); | 95 | accel_dev->accel_id); |
93 | 96 | ||