RDMA/hfi: Decrease PCI device reference count in error path
[ Upstream commit9b51d072da] 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:c513de490f("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>
This commit is contained in:
parent
d8f2a0bc52
commit
34bab85c2e
1 changed files with 2 additions and 0 deletions
|
|
@ -219,6 +219,8 @@ out:
|
|||
for (node = 0; node < node_affinity.num_possible_nodes; node++)
|
||||
hfi1_per_node_cntr[node] = 1;
|
||||
|
||||
pci_dev_put(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue