* [PATCH] crypto: omap-aes: add error check for pm_runtime_get_sync
@ 2013-12-04 1:43 Nishanth Menon
2013-12-05 14:36 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Nishanth Menon @ 2013-12-04 1:43 UTC (permalink / raw)
To: Herbert Xu, David S. Miller
Cc: Tobias Jakobi, Joel F, linux-crypto, linux-kernel, linux-omap,
Nishanth Menon
The AES driver currently assumes that pm_runtime_get_sync will always
succeed, which may not always be true, so add error handling for the
same.
This scenario was reported in the following bug:
place. https://bugzilla.kernel.org/show_bug.cgi?id=66441
Reported-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Signed-off-by: Nishanth Menon <nm@ti.com>
---
Note: the bug in OMAP pm_domain layer is addressed here:
https://patchwork.kernel.org/patch/3280531/
Proper fixes required to make this work is part of the series:
http://marc.info/?l=linux-kernel&m=138541594910233&w=2
drivers/crypto/omap-aes.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index a9ccbf1..dde41f1d 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -784,6 +784,7 @@ static int omap_aes_ctr_decrypt(struct ablkcipher_request *req)
static int omap_aes_cra_init(struct crypto_tfm *tfm)
{
struct omap_aes_dev *dd = NULL;
+ int err;
/* Find AES device, currently picks the first device */
spin_lock_bh(&list_lock);
@@ -792,7 +793,13 @@ static int omap_aes_cra_init(struct crypto_tfm *tfm)
}
spin_unlock_bh(&list_lock);
- pm_runtime_get_sync(dd->dev);
+ err = pm_runtime_get_sync(dd->dev);
+ if (err < 0) {
+ dev_err(dd->dev, "%s: failed to get_sync(%d)\n",
+ __func__, err);
+ return err;
+ }
+
tfm->crt_ablkcipher.reqsize = sizeof(struct omap_aes_reqctx);
return 0;
@@ -1182,7 +1189,12 @@ static int omap_aes_probe(struct platform_device *pdev)
dd->phys_base = res.start;
pm_runtime_enable(dev);
- pm_runtime_get_sync(dev);
+ err = pm_runtime_get_sync(dev);
+ if (err < 0) {
+ dev_err(dev, "%s: failed to get_sync(%d)\n",
+ __func__, err);
+ goto err_res;
+ }
omap_aes_dma_stop(dd);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: omap-aes: add error check for pm_runtime_get_sync
2013-12-04 1:43 [PATCH] crypto: omap-aes: add error check for pm_runtime_get_sync Nishanth Menon
@ 2013-12-05 14:36 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2013-12-05 14:36 UTC (permalink / raw)
To: Nishanth Menon
Cc: David S. Miller, Tobias Jakobi, Joel F, linux-crypto,
linux-kernel, linux-omap
On Tue, Dec 03, 2013 at 07:43:13PM -0600, Nishanth Menon wrote:
> The AES driver currently assumes that pm_runtime_get_sync will always
> succeed, which may not always be true, so add error handling for the
> same.
>
> This scenario was reported in the following bug:
> place. https://bugzilla.kernel.org/show_bug.cgi?id=66441
>
> Reported-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> Signed-off-by: Nishanth Menon <nm@ti.com>
Patch applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-05 14:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-04 1:43 [PATCH] crypto: omap-aes: add error check for pm_runtime_get_sync Nishanth Menon
2013-12-05 14:36 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).