]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: safexcel - Fix potential memory leak in safexcel_pci_probe()
authorAbdun Nihaal <nihaal@cse.iitm.ac.in>
Fri, 8 May 2026 09:03:45 +0000 (14:33 +0530)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 15 May 2026 10:08:48 +0000 (18:08 +0800)
The memory allocated for priv in safexcel_pci_probe() is not freed in the
error paths, as well as in the PCI remove function. Fix this by using
device managed allocation.

Fixes: 625f269a5a7a ("crypto: inside-secure - add support for PCI based FPGA development board")
Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in>
Reviewed-by: Antoine Tenart <atenart@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/inside-secure/safexcel.c

index 812ebabd13096fab680f1820e319ac8ea6c2efbf..52809e57361aa755ed6120e209bd1dc22a6692a2 100644 (file)
@@ -1893,7 +1893,7 @@ static int safexcel_pci_probe(struct pci_dev *pdev,
                ent->vendor, ent->device, ent->subvendor,
                ent->subdevice, ent->driver_data);
 
-       priv = kzalloc_obj(*priv);
+       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;