mirror of https://github.com/torvalds/linux.git
pcim_intx() tries to restore the INTx bit at removal via devres, but there
is a chance that it restores a wrong value.
Because the value to be restored is blindly assumed to be the negative of
the enable argument, when a driver calls pcim_intx() unnecessarily for the
already enabled state, it'll restore to the disabled state in turn. That
is, the function assumes the case like:
// INTx == 1
pcim_intx(pdev, 0); // old INTx value assumed to be 1 -> correct
but it might be like the following, too:
// INTx == 0
pcim_intx(pdev, 0); // old INTx value assumed to be 1 -> wrong
Also, when a driver calls pcim_intx() multiple times with different enable
argument values, the last one will win no matter what value it is. This
can lead to inconsistency, e.g.
// INTx == 1
pcim_intx(pdev, 0); // OK
...
pcim_intx(pdev, 1); // now old INTx wrongly assumed to be 0
This patch addresses those inconsistencies by saving the original INTx
state at the first pcim_intx() call. For that, get_or_create_intx_devres()
is folded into pcim_intx() caller side; it allows us to simply check the
already allocated devres and record the original INTx along with the
devres_alloc() call.
Link: https://lore.kernel.org/r/20241031134300.10296-1-tiwai@suse.de
Fixes:
|
||
|---|---|---|
| .. | ||
| controller | ||
| endpoint | ||
| hotplug | ||
| msi | ||
| pcie | ||
| pwrctrl | ||
| switch | ||
| Kconfig | ||
| Makefile | ||
| access.c | ||
| ats.c | ||
| bus.c | ||
| devres.c | ||
| doe.c | ||
| ecam.c | ||
| host-bridge.c | ||
| iomap.c | ||
| iov.c | ||
| irq.c | ||
| mmap.c | ||
| npem.c | ||
| of.c | ||
| of_property.c | ||
| p2pdma.c | ||
| pci-acpi.c | ||
| pci-bridge-emul.c | ||
| pci-bridge-emul.h | ||
| pci-driver.c | ||
| pci-label.c | ||
| pci-mid.c | ||
| pci-pf-stub.c | ||
| pci-stub.c | ||
| pci-sysfs.c | ||
| pci.c | ||
| pci.h | ||
| probe.c | ||
| proc.c | ||
| quirks.c | ||
| remove.c | ||
| rom.c | ||
| search.c | ||
| setup-bus.c | ||
| setup-res.c | ||
| slot.c | ||
| syscall.c | ||
| tph.c | ||
| vc.c | ||
| vgaarb.c | ||
| vpd.c | ||
| xen-pcifront.c | ||