Commit 0cca961
PCI: Pass domain number to pci_bus_release_domain_nr() explicitly
The 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.
As such, the pci_bus_release_domain_nr() implicitly frees the domain
number by dereferencing 'struct pci_bus'. However, one of the callers
of this API, the 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, pass the domain number to this API explicitly. Since
'struct pci_bus' is not used for anything else other than extracting the
domain number, it makes sense to pass the domain number directly.
Fixes: 0328947 ("PCI: endpoint: Assign PCI domain number for endpoint controllers")
Closes: https://lore.kernel.org/linux-pci/[email protected]
Link: https://lore.kernel.org/linux-pci/[email protected]
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Manivannan Sadhasivam <[email protected]>
[kwilczynski: commit log]
Signed-off-by: Krzysztof Wilczyński <[email protected]>1 parent d14bc28 commit 0cca961
File tree
5 files changed
+11
-11
lines changed- drivers/pci
- endpoint
- include/linux
5 files changed
+11
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
840 | 840 | | |
841 | 841 | | |
842 | 842 | | |
843 | | - | |
| 843 | + | |
844 | 844 | | |
845 | 845 | | |
846 | 846 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6801 | 6801 | | |
6802 | 6802 | | |
6803 | 6803 | | |
6804 | | - | |
| 6804 | + | |
6805 | 6805 | | |
6806 | | - | |
| 6806 | + | |
6807 | 6807 | | |
6808 | 6808 | | |
6809 | 6809 | | |
6810 | | - | |
6811 | | - | |
| 6810 | + | |
| 6811 | + | |
6812 | 6812 | | |
6813 | | - | |
| 6813 | + | |
6814 | 6814 | | |
6815 | 6815 | | |
6816 | 6816 | | |
| |||
6819 | 6819 | | |
6820 | 6820 | | |
6821 | 6821 | | |
6822 | | - | |
| 6822 | + | |
6823 | 6823 | | |
6824 | 6824 | | |
6825 | 6825 | | |
6826 | | - | |
| 6826 | + | |
6827 | 6827 | | |
6828 | 6828 | | |
6829 | 6829 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
1064 | | - | |
| 1064 | + | |
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1884 | 1884 | | |
1885 | 1885 | | |
1886 | 1886 | | |
1887 | | - | |
| 1887 | + | |
1888 | 1888 | | |
1889 | 1889 | | |
1890 | 1890 | | |
| |||
0 commit comments