diff mbox

crypto: omap-sham - potential Oops on error in probe

Message ID 20160518103905.GA10470@mwanda (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Dan Carpenter May 18, 2016, 10:39 a.m. UTC
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 <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Peter Ujfalusi May 18, 2016, 10:42 a.m. UTC | #1
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 <peter.ujfalusi@ti.com>

> Fixes: dbe246209bc1 ('crypto: omap-sham - Use dma_request_chan() for requesting DMA channel')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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");
>
Dan Carpenter May 18, 2016, 11:44 a.m. UTC | #2
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

--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Peter Ujfalusi May 18, 2016, 11:50 a.m. UTC | #3
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.
Herbert Xu May 19, 2016, 10:07 a.m. UTC | #4
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 <dan.carpenter@oracle.com>

Patch applied.  Thanks!
diff mbox

Patch

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");