crypto: tegra-aes - fix error-valued pointer dereference
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Thu, 25 Oct 2012 14:55:04 +0000 (22:55 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 9 Nov 2012 09:32:27 +0000 (17:32 +0800)
clk_put(dd->aes_clk) will dereference an error-valued pointer since the
dd->aes_clk is a ERR_PTR() value. The correct check is call clk_put()
if !IS_ERR(dd->aes_clk).

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/tegra-aes.c

index 19adf1c7faa2316c6f4791806c0683ee4b925856..93059dc591aa40c1b219c73f71b72bc3a73f3c2d 100644 (file)
@@ -1035,7 +1035,7 @@ out:
        if (dd->buf_out)
                dma_free_coherent(dev, AES_HW_DMA_BUFFER_SIZE_BYTES,
                        dd->buf_out, dd->dma_buf_out);
-       if (IS_ERR(dd->aes_clk))
+       if (!IS_ERR(dd->aes_clk))
                clk_put(dd->aes_clk);
        if (aes_wq)
                destroy_workqueue(aes_wq);