[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220530073556.1831-1-miles.chen@mediatek.com>
Date: Mon, 30 May 2022 15:35:56 +0800
From: Miles Chen <miles.chen@...iatek.com>
To: <linmq006@...il.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>, <miles.chen@...iatek.com>, <robh@...nel.org>,
<ryder.lee@...iatek.com>
Subject: Re: [PATCH] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains
Hi Miaoqian,
>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.
Sorry for the confusing. I meant that we can do the same thing -
it calls of_node_put() by goto statement for error paths
and calls of_node_put() before return 0 in normal path. :-)
Thanks,
Miles
Powered by blists - more mailing lists