lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210922042041.16326-1-sergio.paracuellos@gmail.com>
Date:   Wed, 22 Sep 2021 06:20:41 +0200
From:   Sergio Paracuellos <sergio.paracuellos@...il.com>
To:     linux-pci@...r.kernel.org
Cc:     bhelgaas@...gle.com, linux-kernel@...r.kernel.org,
        linux-staging@...ts.linux.dev, gregkh@...uxfoundation.org,
        Liviu.Dudau@....com, robh@...nel.org, catalin.marinas@....com,
        arnd@...db.de
Subject: [PATCH v3] PCI: of: Avoid pci_remap_iospace() when PCI_IOBASE not defined

Request for I/O resources from device tree call 'pci_remap_iospace()' from
'devm_pci_remap_iospace()' which is also called from device tree function
'pci_parse_request_of_pci_ranges()'. If PCI_IOBASE is not defined and I/O
resources are requested the following warning appears:

WARNING: CPU: 2 PID: 1 at ../drivers/pci/pci.c:4066 pci_remap_iospace+0x3c/0x54
This architecture does not support memory mapped I/O

Since there are architectures (like MIPS ralink) that can request I/O
resources from device tree but don't have mappable I/O space and therefore
don't define PCI_IOBASE avoid calling devm_pci_remap_iospace() in that case.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@...il.com>
---
Hi all,

This pach was part of a three patch series [0] and [1] but the other two
patches have been already added through staging git tree. I would like also
this patch going through the staging-tree to have all the three patches merged
together in the same tree, but if it is not possible I can also live with
that :).

Changes in v3:
 - Went back to the same approach that was done in v1 of the series [0].
 - Adjust commit message and description as I was suggested to do by Bjorn.

v1 series:
- [0]: https://lore.kernel.org/linux-pci/20210807072409.9018-2-sergio.paracuellos@gmail.com/T/#meb2e6c283f6d391407cb0c1158feea71de59b87d

v2 series:
- [1]: https://lore.kernel.org/all/20210822161005.22467-1-sergio.paracuellos@gmail.com/ 

Thanks in advance for your time.

Best regards,
    Sergio Paracuellos

 drivers/pci/of.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/of.c b/drivers/pci/of.c
index d84381ce82b5..7d7aab1d1d64 100644
--- a/drivers/pci/of.c
+++ b/drivers/pci/of.c
@@ -564,12 +564,14 @@ static int pci_parse_request_of_pci_ranges(struct device *dev,
 
 		switch (resource_type(res)) {
 		case IORESOURCE_IO:
+#ifdef PCI_IOBASE
 			err = devm_pci_remap_iospace(dev, res, iobase);
 			if (err) {
 				dev_warn(dev, "error %d: failed to map resource %pR\n",
 					 err, res);
 				resource_list_destroy_entry(win);
 			}
+#endif
 			break;
 		case IORESOURCE_MEM:
 			res_valid |= !(res->flags & IORESOURCE_PREFETCH);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ