crypto: crypto4xx - fix a potential double free in ppc4xx_trng_probe
authorWen Yang <wen.yang99@zte.com.cn>
Mon, 8 Jul 2019 06:19:03 +0000 (14:19 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jul 2019 10:16:02 +0000 (18:16 +0800)
commit95566aa75cd6b3b404502c06f66956b5481194b3
tree102cac710aeaca5855b630d1918cb9ddc6744cca
parent049ce1505b3a6504f4cb59148baaacc36d5c75e3
crypto: crypto4xx - fix a potential double free in ppc4xx_trng_probe

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: 5343e674f32f ("crypto4xx: integrate ppc4xx-rng into crypto4xx")
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Cc: <stable@vger.kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Allison Randal <allison@lohutok.net>
Cc: Armijn Hemel <armijn@tjaldur.nl>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/amcc/crypto4xx_trng.c