linux/drivers/crypto/hisilicon
Miaoqian Lin 16e33851c3 crypto: hisilicon/qm - Fix device reference leak in qm_get_qos_value
commit 59b0afd01b upstream.

The qm_get_qos_value() function calls bus_find_device_by_name() which
increases the device reference count, but fails to call put_device()
to balance the reference count and lead to a device reference leak.

Add put_device() calls in both the error path and success path to
properly balance the reference count.

Found via static analysis.

Fixes: 22d7a6c39c ("crypto: hisilicon/qm - add pci bdf number check")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Longfang Liu <liulongfang@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-11-24 10:36:01 +01:00
..
hpre crypto: hisilicon - re-enable address prefetch after device resuming 2025-10-15 12:00:06 +02:00
sec crypto: hisilicon/sec - Remove trailing space after \n newline 2024-09-06 14:50:46 +08:00
sec2 crypto: hisilicon - re-enable address prefetch after device resuming 2025-10-15 12:00:06 +02:00
trng crypto: hisilicon/trng - modifying the order of header files 2024-09-06 14:50:46 +08:00
zip crypto: hisilicon - re-enable address prefetch after device resuming 2025-10-15 12:00:06 +02:00
debugfs.c crypto: hisilicon/qm - set NULL to qm->debug.qm_diff_regs 2025-10-15 12:00:14 +02:00
Kconfig hwrng: histb - Move driver to drivers/char/hw_random/histb-rng.c 2023-05-12 18:48:01 +08:00
Makefile hwrng: histb - Move driver to drivers/char/hw_random/histb-rng.c 2023-05-12 18:48:01 +08:00
qm.c crypto: hisilicon/qm - Fix device reference leak in qm_get_qos_value 2025-11-24 10:36:01 +01:00
qm_common.h crypto: hisilicon/qm - simplify the status of qm 2023-12-01 18:03:26 +08:00
sgl.c crypto: hisilicon - fix missed error branch 2024-09-06 14:50:46 +08:00