[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6cf820cf-a2e7-c93e-3c00-08bc366f2eb2@gmail.com>
Date: Mon, 30 May 2022 14:54:03 +0800
From: Miaoqian Lin <linmq006@...il.com>
To: Miles Chen <miles.chen@...iatek.com>
Cc: bhelgaas@...gle.com, jianjun.wang@...iatek.com, kw@...ux.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-mediatek@...ts.infradead.org, linux-pci@...r.kernel.org,
lorenzo.pieralisi@....com, matthias.bgg@...il.com, maz@...nel.org,
robh@...nel.org, ryder.lee@...iatek.com
Subject: Re: [PATCH] PCI: mediatek-gen3: Fix refcount leak in
mtk_pcie_init_irq_domains
Hi, Miles
On 2022/5/30 10:19, Miles Chen wrote:
> Hi Miaoqian,
>
>>>> &intx_domain_ops, pcie);
>>>> if (!pcie->intx_domain) {
>>>> dev_err(dev, "failed to create INTx IRQ domain\n");
>>>> + of_node_put(intc_node);
>>>> return -ENODEV;
>>>> }
>>> Thanks for doing this.
>>>
>>> I checked mtk_pcie_init_irq_domains() and there are multiple exit paths like
>>> err_msi_domain and err_msi_bottom_domain and the normal path which also
>>> need of_node_put(intc_node).
>> Thanks for your reply,
>>
>> I didn't add of_node_put() in other paths because I am not sure if the reference passed through irq_domain_add_linear(), since intc_node is passed to irq_domain_add_linear().
>>
>> __irq_domain_add() keeps &node->fwnode in the irq_domain structure.
>>
>> and use fwnode_handle_get() to get the reference of fwnode, but I still uncertain.
>>
>> If the reference don't needed anymore after irq_domain_add_linear(),
>>
>> your suggestion looks fine, and I will submit v2.
>
> Thanks for your reply, I think we can do similar things like
> rtl8365mb_irq_setup() in drivers/net/dsa/realtek/rtl8365mb.c
I checked rtl8365mb_irq_setup(), it calls of_node_put() by goto statement for error paths.
and calls of_node_put() before return 0 in normal path. I didn't see the same problem.
> Thanks,
> Miles
Powered by blists - more mailing lists