summaryrefslogtreecommitdiff
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorKrzysztof Wilczyński <kwilczynski@kernel.org>2026-05-08 04:35:22 +0000
committerBjorn Helgaas <bhelgaas@google.com>2026-05-08 17:44:47 -0500
commit04fbecc947ec3a2149680d29b9cdc147fc012fba (patch)
treeb2eac0bea6bb33cf18e45d35f49b3c2b4d1c0939 /include/uapi/linux
parent77c5f3def45937f3f90ea4018cfdf9342b78b78a (diff)
PCI/sysfs: Only allow supported resource types in I/O and MMIO helpers
Currently, when the sysfs attributes for PCI resources are added dynamically, the resource access callbacks are only set when the underlying BAR type matches, using .read and .write for IORESOURCE_IO, and .mmap for IORESOURCE_MEM or IORESOURCE_IO with arch_can_pci_mmap_io() support. As such, when the callback is not set, the operation inherently fails. After the conversion to static attributes, visibility callbacks will control which resource files appear for each BAR, but the callbacks themselves will always be set. Add a type check to pci_resource_io() and pci_mmap_resource() to return -EIO for an unsupported resource type. Use the new pci_resource_is_io() and pci_resource_is_mem() helpers for the type checks, replacing the open-coded bitwise flag tests and also drop the local struct resource pointer in pci_mmap_resource(). Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://patch.msgid.link/20260508043543.217179-4-kwilczynski@kernel.org
Diffstat (limited to 'include/uapi/linux')
0 files changed, 0 insertions, 0 deletions