Skip to content

Commit

Permalink
crypto: ccp - Fix a resource leak in an error handling path
Browse files Browse the repository at this point in the history
[ Upstream commit a6f8e68 ]

If an error occurs after calling 'sp_get_irqs()', 'sp_free_irqs()' must be
called as already done in the error handling path.

Fixes: f4d18d6 ("crypto: ccp - Abstract interrupt registeration")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: John Allen <john.allen@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and gregkh committed Jul 14, 2021
1 parent e6678d8 commit 1640411
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/crypto/ccp/sp-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,20 @@ static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (ret) {
dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n",
ret);
goto e_err;
goto free_irqs;
}
}

dev_set_drvdata(dev, sp);

ret = sp_init(sp);
if (ret)
goto e_err;
goto free_irqs;

return 0;

free_irqs:
sp_free_irqs(sp);
e_err:
dev_notice(dev, "initialization failed\n");
return ret;
Expand Down

0 comments on commit 1640411

Please sign in to comment.