crypto/nx: Initialize coproc entry with kzalloc
authorHaren Myneni <haren@linux.ibm.com>
Fri, 17 Apr 2020 09:02:43 +0000 (02:02 -0700)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 20 Apr 2020 06:53:14 +0000 (16:53 +1000)
coproc entry is initialized during NX probe on power9, but not on P8.
nx842_delete_coprocs() is used for both and frees receive window if it
is allocated. Getting crash for rmmod on P8 since coproc->vas.rxwin
is not initialized.

This patch replaces kmalloc with kzalloc in nx842_powernv_probe()

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1587114163.2275.1110.camel@hbabu-laptop
drivers/crypto/nx/nx-842-powernv.c

index c037a2403b82c369c2c7558af5d49242ea46afbc..8e63326f0866983876dcbded1863cabcf1310bd3 100644 (file)
@@ -922,7 +922,7 @@ static int __init nx842_powernv_probe(struct device_node *dn)
                return -EINVAL;
        }
 
-       coproc = kmalloc(sizeof(*coproc), GFP_KERNEL);
+       coproc = kzalloc(sizeof(*coproc), GFP_KERNEL);
        if (!coproc)
                return -ENOMEM;