[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e35d1541-8bd7-447d-b544-e8fb8cce287a@quicinc.com>
Date: Tue, 12 Nov 2024 15:18:19 +0800
From: quic_zijuhu <quic_zijuhu@...cinc.com>
To: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Zijun Hu
<zijun_hu@...oud.com>
CC: Krzysztof Wilczyński <kw@...ux.com>,
Kishon Vijay Abraham
I <kishon@...nel.org>,
Bjorn Helgaas <bhelgaas@...gle.com>, Frank Li
<Frank.Li@....com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof Wilczyński <kwilczynski@...nel.org>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Jingoo Han
<jingoohan1@...il.com>,
Marek Vasut <marek.vasut+renesas@...il.com>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Shawn Lin
<shawn.lin@...k-chips.com>,
Heiko Stuebner <heiko@...ech.de>, <stable@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] PCI: endpoint: Fix API pci_epc_destroy() releasing
domain_nr ID faults
On 11/12/2024 3:03 PM, Manivannan Sadhasivam wrote:
> On Thu, Nov 07, 2024 at 08:53:08AM +0800, Zijun Hu wrote:
>> From: Zijun Hu <quic_zijuhu@...cinc.com>
>>
>> pci_epc_destroy() invokes pci_bus_release_domain_nr() to release domain_nr
>> ID, but the invocation has below 2 faults:
>>
>> - The later accesses device @epc->dev which has been kfree()ed by previous
>> device_unregister(), namely, it is a UAF issue.
>>
>> - The later frees the domain_nr ID into @epc->dev, but the ID is actually
>> allocated from @epc->dev.parent, so it will destroy domain_nr IDA.
>>
>> Fix by freeing the ID to @epc->dev.parent before unregistering @epc->dev.
>>
>> The file(s) affected are shown below since they indirectly use the API.
>> drivers/pci/controller/cadence/pcie-cadence-ep.c
>> drivers/pci/controller/dwc/pcie-designware-ep.c
>> drivers/pci/controller/pcie-rockchip-ep.c
>> drivers/pci/controller/pcie-rcar-ep.c
>
> No need to mention the callers.
>
thank you Manivannan for code review.
good suggestions, i will take them for further similar patches.(^^)
>>
>> Fixes: 0328947c5032 ("PCI: endpoint: Assign PCI domain number for endpoint controllers")
>> Cc: Lorenzo Pieralisi <lpieralisi@...nel.org>
>> Cc: Jingoo Han <jingoohan1@...il.com>
>> Cc: Marek Vasut <marek.vasut+renesas@...il.com>
>> Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
>> Cc: Shawn Lin <shawn.lin@...k-chips.com>
>> Cc: Heiko Stuebner <heiko@...ech.de>
>> Cc: stable@...r.kernel.org
>> Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
>
> Good catch! (not sure how I messed up in first place).
>
> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>
>
> - Mani
>
>> ---
[snip]
>>
>
Powered by blists - more mailing lists