On Mon, 8 Jul 2019, Wen Yang wrote:

> There is a possible double free issue in ppc4xx_trng_probe():
>
> 85:   dev->trng_base = of_iomap(trng, 0);
> 86:   of_node_put(trng);          ---> released here
> 87:   if (!dev->trng_base)
> 88:           goto err_out;
> ...
> 110:  ierr_out:
> 111:          of_node_put(trng);  ---> double released here
> ...
>
> This issue was detected by using the Coccinelle software.
> We fix it by removing the unnecessary of_node_put().
>
> Fixes: 5343e674f32 ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
> Signed-off-by: Wen Yang <wen.yan...@zte.com.cn>
> Cc: Herbert Xu <herb...@gondor.apana.org.au>
> Cc: "David S. Miller" <da...@davemloft.net>
> Cc: Thomas Gleixner <t...@linutronix.de>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Allison Randal <alli...@lohutok.net>
> Cc: Armijn Hemel <arm...@tjaldur.nl>
> Cc: Julia Lawall <julia.law...@lip6.fr>
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-ker...@vger.kernel.org

Acked-by: Julia Lawall <julia.law...@lip6.fr>


> ---
>  drivers/crypto/amcc/crypto4xx_trng.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/crypto/amcc/crypto4xx_trng.c 
> b/drivers/crypto/amcc/crypto4xx_trng.c
> index 02a6bed3..f10a87e 100644
> --- a/drivers/crypto/amcc/crypto4xx_trng.c
> +++ b/drivers/crypto/amcc/crypto4xx_trng.c
> @@ -108,7 +108,6 @@ void ppc4xx_trng_probe(struct crypto4xx_core_device 
> *core_dev)
>       return;
>
>  err_out:
> -     of_node_put(trng);
>       iounmap(dev->trng_base);
>       kfree(rng);
>       dev->trng_base = NULL;
> --
> 2.9.5
>
>

Reply via email to