2016-05-18 10:39:36

by Dan Carpenter

[permalink] [raw]
Subject: [patch] crypto: omap-sham - potential Oops on error in probe

This if statement is reversed so we end up either leaking or Oopsing on
error.

Fixes: dbe246209bc1 ('crypto: omap-sham - Use dma_request_chan() for requesting DMA channel')
Signed-off-by: Dan Carpenter <[email protected]>

diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
index 6eefaa2..63464e8 100644
--- a/drivers/crypto/omap-sham.c
+++ b/drivers/crypto/omap-sham.c
@@ -1986,7 +1986,7 @@ err_algs:
&dd->pdata->algs_info[i].algs_list[j]);
err_pm:
pm_runtime_disable(dev);
- if (dd->polling_mode)
+ if (!dd->polling_mode)
dma_release_channel(dd->dma_lch);
data_err:
dev_err(dev, "initialization failed.\n");


2016-05-18 10:42:36

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [patch] crypto: omap-sham - potential Oops on error in probe

On 05/18/16 13:39, Dan Carpenter wrote:
> This if statement is reversed so we end up either leaking or Oopsing on
> error.

Oops, sorry for that.
Probably the other omap-* crypto drivers have the same issue? Can you send a
patch for them or should I do it?

Acked-by: Peter Ujfalusi <[email protected]>

> Fixes: dbe246209bc1 ('crypto: omap-sham - Use dma_request_chan() for requesting DMA channel')
> Signed-off-by: Dan Carpenter <[email protected]>
>
> diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c
> index 6eefaa2..63464e8 100644
> --- a/drivers/crypto/omap-sham.c
> +++ b/drivers/crypto/omap-sham.c
> @@ -1986,7 +1986,7 @@ err_algs:
> &dd->pdata->algs_info[i].algs_list[j]);
> err_pm:
> pm_runtime_disable(dev);
> - if (dd->polling_mode)
> + if (!dd->polling_mode)
> dma_release_channel(dd->dma_lch);
> data_err:
> dev_err(dev, "initialization failed.\n");
>


--
P?ter

2016-05-18 11:44:43

by Dan Carpenter

[permalink] [raw]
Subject: Re: [patch] crypto: omap-sham - potential Oops on error in probe

On Wed, May 18, 2016 at 01:42:36PM +0300, Peter Ujfalusi wrote:
> On 05/18/16 13:39, Dan Carpenter wrote:
> > This if statement is reversed so we end up either leaking or Oopsing on
> > error.
>
> Oops, sorry for that.
> Probably the other omap-* crypto drivers have the same issue? Can you send a
> patch for them or should I do it?

I didn't see those static checker warnings so probably it means I can't
compile the drivers. Could you do it?

regards,
dan carpenter


2016-05-18 11:50:12

by Peter Ujfalusi

[permalink] [raw]
Subject: Re: [patch] crypto: omap-sham - potential Oops on error in probe

On 05/18/16 14:44, Dan Carpenter wrote:
> On Wed, May 18, 2016 at 01:42:36PM +0300, Peter Ujfalusi wrote:
>> On 05/18/16 13:39, Dan Carpenter wrote:
>>> This if statement is reversed so we end up either leaking or Oopsing on
>>> error.
>>
>> Oops, sorry for that.
>> Probably the other omap-* crypto drivers have the same issue? Can you send a
>> patch for them or should I do it?
>
> I didn't see those static checker warnings so probably it means I can't
> compile the drivers. Could you do it?

I have taken a look at omap-aes and omap-des. They are OK.

--
P?ter

2016-05-19 10:07:42

by Herbert Xu

[permalink] [raw]
Subject: Re: [patch] crypto: omap-sham - potential Oops on error in probe

On Wed, May 18, 2016 at 01:39:05PM +0300, Dan Carpenter wrote:
> This if statement is reversed so we end up either leaking or Oopsing on
> error.
>
> Fixes: dbe246209bc1 ('crypto: omap-sham - Use dma_request_chan() for requesting DMA channel')
> Signed-off-by: Dan Carpenter <[email protected]>

Patch applied. Thanks!
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt