]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/hfi: Decrease PCI device reference count in error path
authorXiongfeng Wang <wangxiongfeng2@huawei.com>
Thu, 17 Nov 2022 13:15:46 +0000 (21:15 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:18 +0000 (11:41 +0100)
commit628aacd25cde462782944fcbfdcc89dbf294ca90
tree32e42e4ff04b108c4de4ed2a9cb712fdfcf1f550
parent69bcfb476169cc2be788851d8bd6cd77ace67b64
RDMA/hfi: Decrease PCI device reference count in error path

[ Upstream commit dfe9270b4ec682e47df6f86e09cdfdb4cc340dbe ]

pci_get_device() will increase the reference count for the returned
pci_dev, and also decrease the reference count for the input parameter
*from* if it is not NULL.

If we break out the loop in node_affinity_init() with 'dev' not NULL, we
need to call pci_dev_put() to decrease the reference count. Add missing
pci_dev_put() in error path.

Fixes: 0f02797f2ce7 ("IB/hfi1: Invalid NUMA node information can cause a divide by zero")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
Link: https://lore.kernel.org/r/20221117131546.113280-1-wangxiongfeng2@huawei.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hfi1/affinity.c