diff options
author | Xiongfeng Wang <wangxiongfeng2@huawei.com> | 2022-11-17 21:15:46 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 09:26:21 +0100 |
commit | f3f0ebece87c1488695a504f3b2d41eab0637d2f (patch) | |
tree | da3c140a063f6217cb0d10ae587941e0a5b43f65 | |
parent | f0767e933361364497c769d375a840fdcbb945b5 (diff) | |
download | linux-stable-f3f0ebece87c1488695a504f3b2d41eab0637d2f.tar.gz linux-stable-f3f0ebece87c1488695a504f3b2d41eab0637d2f.tar.bz2 linux-stable-f3f0ebece87c1488695a504f3b2d41eab0637d2f.zip |
RDMA/hfi: Decrease PCI device reference count in error path
[ Upstream commit 9b51d072da1d27e1193e84708201c48e385ad912 ]
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: c513de490f80 ("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>
-rw-r--r-- | drivers/infiniband/hw/hfi1/affinity.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c index b197e925fe36..4cc7f67ea54c 100644 --- a/drivers/infiniband/hw/hfi1/affinity.c +++ b/drivers/infiniband/hw/hfi1/affinity.c @@ -165,6 +165,8 @@ out: for (node = 0; node < node_affinity.num_possible_nodes; node++) hfi1_per_node_cntr[node] = 1; + pci_dev_put(dev); + return 0; } |