* [PATCH] hwrng: cavium - Fix PF register mapping leak on probe failure
@ 2026-11-17 13:38 Haoxiang Li
2026-11-27 5:12 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Haoxiang Li @ 2026-11-17 13:38 UTC (permalink / raw)
To: olivia, herbert, kees+treewide, sgoutham
Cc: linux-crypto, linux-kernel, Haoxiang Li
cavium_map_pf_regs() maps the PF registers with ioremap(), but the
mapping is not released if devm_hwrng_register() fails. Call iounmap()
before returning the registration error.
Fixes: 680efb33546b ("hwrng: cavium - Check health status while reading random data")
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
drivers/char/hw_random/cavium-rng-vf.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/hw_random/cavium-rng-vf.c b/drivers/char/hw_random/cavium-rng-vf.c
index 14eb74a70f89..e0f9ce01a896 100644
--- a/drivers/char/hw_random/cavium-rng-vf.c
+++ b/drivers/char/hw_random/cavium-rng-vf.c
@@ -236,6 +236,7 @@ static int cavium_rng_probe_vf(struct pci_dev *pdev,
ret = devm_hwrng_register(&pdev->dev, &rng->ops);
if (ret) {
dev_err(&pdev->dev, "Error registering device as HWRNG.\n");
+ iounmap(rng->pf_regbase);
return ret;
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] hwrng: cavium - Fix PF register mapping leak on probe failure
2026-11-17 13:38 [PATCH] hwrng: cavium - Fix PF register mapping leak on probe failure Haoxiang Li
@ 2026-11-27 5:12 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-11-27 5:12 UTC (permalink / raw)
To: Haoxiang Li; +Cc: olivia, kees+treewide, sgoutham, linux-crypto, linux-kernel
On Tue, Nov 17, 2026 at 09:38:44PM +0800, Haoxiang Li wrote:
> cavium_map_pf_regs() maps the PF registers with ioremap(), but the
> mapping is not released if devm_hwrng_register() fails. Call iounmap()
> before returning the registration error.
>
> Fixes: 680efb33546b ("hwrng: cavium - Check health status while reading random data")
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> drivers/char/hw_random/cavium-rng-vf.c | 1 +
> 1 file changed, 1 insertion(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 5:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-17 13:38 [PATCH] hwrng: cavium - Fix PF register mapping leak on probe failure Haoxiang Li
2026-11-27 5:12 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®