linux/drivers/char/hw_random
Xiongfeng Wang 19b7b85773 hwrng: geode - Fix PCI device refcount leak
[ Upstream commit 9f6ec8dc57 ]

for_each_pci_dev() is implemented by pci_get_device(). The comment of
pci_get_device() says that it will increase the reference count for the
returned pci_dev and also decrease the reference count for the input
pci_dev @from if it is not NULL.

If we break for_each_pci_dev() loop with pdev not NULL, we need to call
pci_dev_put() to decrease the reference count. We add a new struct
'amd_geode_priv' to record pointer of the pci_dev and membase, and then
add missing pci_dev_put() for the normal and error path.

Fixes: ef5d862734 ("[PATCH] Add Geode HW RNG driver")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-12-31 13:32:37 +01:00
..
amd-rng.c
arm_smccc_trng.c
atmel-rng.c
ba431-rng.c
bcm2835-rng.c
cavium-rng-vf.c
cavium-rng.c
cctrng.c
cctrng.h
cn10k-rng.c
core.c
exynos-trng.c
geode-rng.c
hisi-rng.c
imx-rngc.c
ingenic-rng.c
ingenic-trng.c
intel-rng.c
iproc-rng200.c
ixp4xx-rng.c
Kconfig
ks-sa-rng.c
Makefile
meson-rng.c
mpfs-rng.c
mtk-rng.c
mxc-rnga.c
n2-asm.S
n2-drv.c
n2rng.h
nomadik-rng.c
npcm-rng.c
octeon-rng.c
omap-rng.c
omap3-rom-rng.c
optee-rng.c
pasemi-rng.c
pic32-rng.c
powernv-rng.c
pseries-rng.c
s390-trng.c
st-rng.c
stm32-rng.c
timeriomem-rng.c
via-rng.c
virtio-rng.c
xgene-rng.c
xiphera-trng.c