linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: omap-sham - Only release DMA channel if successfully requested
@ 2013-11-12 20:12 Mark A. Greer
  2013-12-05 14:35 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Mark A. Greer @ 2013-11-12 20:12 UTC (permalink / raw)
  To: linux-crypto
  Cc: Herbert Xu, Joel Fernandes, Mark A. Greer, linux-arm-kernel,
	linux-omap, David S. Miller, Dan Carpenter

In omap_sham_probe() and omap_sham_remove(), 'dd->dma_lch'
is released without checking to see if it was successfully
requested or not.  This is a bug and was identified and
reported by Dan Carpenter here:

	http://www.spinics.net/lists/devicetree/msg11023.html

Add code to only release 'dd->dma_lch' when its not NULL
(that is, when it was successfully requested).

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
CC: Joel Fernandes <joelf@ti.com>
Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
---
 drivers/crypto/omap-sham.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index e28104b..c6ad7d6 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1970,7 +1970,8 @@ err_algs:
 			crypto_unregister_ahash(
 					&dd->pdata->algs_info[i].algs_list[j]);
 	pm_runtime_disable(dev);
-	dma_release_channel(dd->dma_lch);
+	if (dd->dma_lch)
+		dma_release_channel(dd->dma_lch);
 data_err:
 	dev_err(dev, "initialization failed.\n");
 
@@ -1994,7 +1995,9 @@ static int omap_sham_remove(struct platform_device *pdev)
 					&dd->pdata->algs_info[i].algs_list[j]);
 	tasklet_kill(&dd->done_task);
 	pm_runtime_disable(&pdev->dev);
-	dma_release_channel(dd->dma_lch);
+
+	if (dd->dma_lch)
+		dma_release_channel(dd->dma_lch);
 
 	return 0;
 }
-- 
1.8.3.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: omap-sham - Only release DMA channel if successfully requested
  2013-11-12 20:12 [PATCH] crypto: omap-sham - Only release DMA channel if successfully requested Mark A. Greer
@ 2013-12-05 14:35 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2013-12-05 14:35 UTC (permalink / raw)
  To: Mark A. Greer
  Cc: linux-crypto, linux-omap, linux-arm-kernel, David S. Miller,
	Dan Carpenter, Joel Fernandes

On Tue, Nov 12, 2013 at 01:12:27PM -0700, Mark A. Greer wrote:
> In omap_sham_probe() and omap_sham_remove(), 'dd->dma_lch'
> is released without checking to see if it was successfully
> requested or not.  This is a bug and was identified and
> reported by Dan Carpenter here:
> 
> 	http://www.spinics.net/lists/devicetree/msg11023.html
> 
> Add code to only release 'dd->dma_lch' when its not NULL
> (that is, when it was successfully requested).
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> CC: Joel Fernandes <joelf@ti.com>
> Signed-off-by: Mark A. Greer <mgreer@animalcreek.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:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-12 20:12 [PATCH] crypto: omap-sham - Only release DMA channel if successfully requested Mark A. Greer
2013-12-05 14:35 ` 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).