Re: [PATCH] PCI: Pass domain number explicitly to pci_bus_release_domain_nr() API

From: Krzysztof Wilczyński
Date: Fri Sep 13 2024 - 18:50:25 EST


Hello,

> pci_bus_release_domain_nr() API is supposed to free the domain number
> allocated by pci_bus_find_domain_nr(). Most of the callers of
> pci_bus_find_domain_nr(), store the domain number in pci_bus::domain_nr.
>
> So pci_bus_release_domain_nr() implicitly frees the domain number by
> dereferencing 'struct pci_bus'. But one of the callers of this API, PCI
> endpoint subsystem doesn't have 'struct pci_bus', so it only passes NULL.
> Due to this, the API will end up dereferencing the NULL pointer.
>
> To fix this issue, let's just pass the domain number explicitly to this
> API. Since 'struct pci_bus' is not used for any other purposes in this API
> other than extracting the domain number, it makes sense to pass the domain
> number directly.

Applied to controller/qcom, thank you!

[1/1] PCI: Pass domain number to pci_bus_release_domain_nr() explicitly
https://git.kernel.org/pci/pci/c/0cca961a0261

Krzysztof